From 6a35f7acabcd0a45c22be6dbb69c16eb38513e34 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Mon, 5 Aug 2024 09:10:16 +0200 Subject: [PATCH 01/61] Implement MPC usecase for the MonitoredUnit actor type Co-authored-by: Simon Thelen --- usecases/README.md | 5 + usecases/api/mu_mpc.go | 69 +++++ usecases/mu/mpc/events.go | 10 + usecases/mu/mpc/public.go | 160 ++++++++++++ usecases/mu/mpc/public_test.go | 40 +++ usecases/mu/mpc/testhelper_test.go | 81 ++++++ usecases/mu/mpc/types.go | 10 + usecases/mu/mpc/usecase.go | 400 +++++++++++++++++++++++++++++ usecases/usecase/events.go | 2 +- usecases/usecase/usecase.go | 6 +- 10 files changed, 781 insertions(+), 2 deletions(-) create mode 100644 usecases/api/mu_mpc.go create mode 100644 usecases/mu/mpc/events.go create mode 100644 usecases/mu/mpc/public.go create mode 100644 usecases/mu/mpc/public_test.go create mode 100644 usecases/mu/mpc/testhelper_test.go create mode 100644 usecases/mu/mpc/types.go create mode 100644 usecases/mu/mpc/usecase.go diff --git a/usecases/README.md b/usecases/README.md index 47a977b1..88166c85 100644 --- a/usecases/README.md +++ b/usecases/README.md @@ -34,3 +34,8 @@ Actors: Use Cases: - `mpc`: Monitoring of Power Consumption - `mgcp`: Monitoring of Grid Connection Point + +- `mu`: Monitored Unit + + Use Cases: + - `mpc`: Monitoring of Power Consumption diff --git a/usecases/api/mu_mpc.go b/usecases/api/mu_mpc.go new file mode 100644 index 00000000..24145d24 --- /dev/null +++ b/usecases/api/mu_mpc.go @@ -0,0 +1,69 @@ +package api + +import ( + "github.com/enbility/eebus-go/api" +) + +// Actor: Monitoring Unit +// UseCase: Monitoring of Power Consumption +type MuMPCInterface interface { + api.UseCaseInterface + + // Scenario 1 + + // set the momentary active power consumption or production + // + // parameters: + // - power: the active power + SetPower(power float64) error + + // set the momentary active phase specific power consumption or production per phase + // + // parameters: + // - phaseA: the active power of phase A + // - phaseB: the active power of phase B + // - phaseC: the active power of phase C + SetPowerPerPhase(phaseA, phaseB, phaseC float64) error + + // Scenario 2 + + // set the total consumption energy + // + // parameters: + // - consumed: the total consumption energy + SetEnergyConsumed(consumed float64) error + + // set the total feed in energy + // + // parameters: + // - produced: the total feed in energy + SetEnergyProduced(produced float64) error + + // Scenario 3 + + // set the momentary phase specific current consumption or production + // + // parameters: + // - phaseA: the current of phase A + // - phaseB: the current of phase B + // - phaseC: the current of phase C + SetCurrentPerPhase(phaseA, phaseB, phaseC float64) error + + // Scenario 4 + + // set the phase specific voltage details + // + // parameters: + // - phaseA: the voltage of phase A + // - phaseB: the voltage of phase B + // - phaseC: the voltage of phase C + SetVoltagePerPhase(phaseA, phaseB, phaseC float64) error + + // Scenario 5 + + // set frequency + // + // parameters: + // - frequency: the frequency + SetFrequency(frequency float64) error +} diff --git a/usecases/mu/mpc/events.go b/usecases/mu/mpc/events.go new file mode 100644 index 00000000..c05e05aa --- /dev/null +++ b/usecases/mu/mpc/events.go @@ -0,0 +1,10 @@ +package mpc + +import ( + spineapi "github.com/enbility/spine-go/api" +) + +// handle SPINE events +func (e *MPC) HandleEvent(payload spineapi.EventPayload) { + // No events supported +} diff --git a/usecases/mu/mpc/public.go b/usecases/mu/mpc/public.go new file mode 100644 index 00000000..46f95935 --- /dev/null +++ b/usecases/mu/mpc/public.go @@ -0,0 +1,160 @@ +package mpc + +import ( + "github.com/enbility/eebus-go/api" +) + +// Scenario 1 + +// set the momentary active power consumption or production +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (e *MPC) SetPower(power float64) error { + if e.acPowerTotal == nil { + return api.ErrMissingData + } + + err := e.setMeasurementDataForId(e.acPowerTotal, power) + if err != nil { + return err + } + + return nil +} + +// set the momentary active power consumption or production per phase +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (e *MPC) SetPowerPerPhase(phaseA, phaseB, phaseC float64) error { + if e.acPower[0] == nil || e.acPower[1] == nil || e.acPower[2] == nil { + return api.ErrMissingData + } + + err := e.setMeasurementDataForId(e.acPower[0], phaseA) + if err != nil { + return err + } + + err = e.setMeasurementDataForId(e.acPower[1], phaseB) + if err != nil { + return err + } + + err = e.setMeasurementDataForId(e.acPower[2], phaseC) + if err != nil { + return err + } + + return nil +} + +// Scenario 2 + +// set the total consumption energy +// +// - positive values are used for consumption +func (e *MPC) SetEnergyConsumed(energy float64) error { + if e.acEnergyConsumed == nil { + return api.ErrMissingData + } + + err := e.setMeasurementDataForId(e.acEnergyConsumed, energy) + if err != nil { + return err + } + + return nil +} + +// set the total feed in energy +// +// - negative values are used for production +func (e *MPC) SetEnergyProduced(energy float64) error { + if e.acEnergyProduced == nil { + return api.ErrMissingData + } + + err := e.setMeasurementDataForId(e.acEnergyProduced, energy) + if err != nil { + return err + } + + return nil +} + +// Scenario 3 + +// set the momentary phase specific current consumption or production +// +// - positive values are used for consumption +// - negative values are used for production +func (e *MPC) SetCurrentPerPhase(phaseA, phaseB, phaseC float64) error { + if e.acCurrent[0] == nil || e.acCurrent[1] == nil || e.acCurrent[2] == nil { + return api.ErrMissingData + } + + err := e.setMeasurementDataForId(e.acCurrent[0], phaseA) + if err != nil { + return err + } + + err = e.setMeasurementDataForId(e.acCurrent[1], phaseB) + if err != nil { + return err + } + + err = e.setMeasurementDataForId(e.acCurrent[2], phaseC) + if err != nil { + return err + } + + return nil +} + +// Scenario 4 + +// set the phase specific voltage details +func (e *MPC) SetVoltagePerPhase(phaseA, phaseB, phaseC float64) error { + for _, id := range e.acVoltage { + if id == nil { + return api.ErrMissingData + } + } + + err := e.setMeasurementDataForId(e.acVoltage[0], phaseA) + if err != nil { + return err + } + + err = e.setMeasurementDataForId(e.acVoltage[1], phaseB) + if err != nil { + return err + } + + err = e.setMeasurementDataForId(e.acVoltage[2], phaseC) + if err != nil { + return err + } + + return nil +} + +// Scenario 5 + +// SetFrequency set frequency +func (e *MPC) SetFrequency(frequency float64) error { + if e.acFrequency == nil { + return api.ErrMissingData + } + + err := e.setMeasurementDataForId(e.acFrequency, frequency) + if err != nil { + return err + } + + return nil +} diff --git a/usecases/mu/mpc/public_test.go b/usecases/mu/mpc/public_test.go new file mode 100644 index 00000000..decee094 --- /dev/null +++ b/usecases/mu/mpc/public_test.go @@ -0,0 +1,40 @@ +package mpc + +import ( + "github.com/stretchr/testify/assert" +) + +func (s *MuMPCSuite) Test_Power() { + err := s.sut.SetPower(5.0) + assert.Nil(s.T(), err) +} + +func (s *MuMPCSuite) Test_PowerPerPhase() { + err := s.sut.SetPowerPerPhase(5.0, 5.0, 5.0) + assert.Nil(s.T(), err) +} + +func (s *MuMPCSuite) Test_EnergyConsumed() { + err := s.sut.SetEnergyConsumed(5.0) + assert.Nil(s.T(), err) +} + +func (s *MuMPCSuite) Test_EnergyProduced() { + err := s.sut.SetEnergyProduced(5.0) + assert.Nil(s.T(), err) +} + +func (s *MuMPCSuite) Test_CurrentPerPhase() { + err := s.sut.SetCurrentPerPhase(5.0, 5.0, 5.0) + assert.Nil(s.T(), err) +} + +func (s *MuMPCSuite) Test_VoltagePerPhase() { + err := s.sut.SetVoltagePerPhase(5.0, 5.0, 5.0) + assert.Nil(s.T(), err) +} + +func (s *MuMPCSuite) Test_Frequency() { + err := s.sut.SetFrequency(5.0) + assert.Nil(s.T(), err) +} diff --git a/usecases/mu/mpc/testhelper_test.go b/usecases/mu/mpc/testhelper_test.go new file mode 100644 index 00000000..e983480d --- /dev/null +++ b/usecases/mu/mpc/testhelper_test.go @@ -0,0 +1,81 @@ +package mpc + +import ( + "testing" + "time" + + "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/mocks" + "github.com/enbility/eebus-go/service" + shipapi "github.com/enbility/ship-go/api" + "github.com/enbility/ship-go/cert" + spineapi "github.com/enbility/spine-go/api" + spinemocks "github.com/enbility/spine-go/mocks" + "github.com/enbility/spine-go/model" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" +) + +const remoteSki string = "testremoteski" + +func TestMuMPCSuite(t *testing.T) { + suite.Run(t, new(MuMPCSuite)) +} + +type MuMPCSuite struct { + suite.Suite + + sut *MPC + + service api.ServiceInterface + + remoteDevice spineapi.DeviceRemoteInterface + mockRemoteEntity *spinemocks.EntityRemoteInterface + monitoredEntity spineapi.EntityRemoteInterface + loadControlFeature, + deviceDiagnosisFeature, + deviceConfigurationFeature spineapi.FeatureLocalInterface + + eventCalled bool +} + +func (s *MuMPCSuite) Event(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event api.EventType) { + s.eventCalled = true +} + +func (s *MuMPCSuite) BeforeTest(suiteName, testName string) { + s.eventCalled = false + cert, _ := cert.CreateCertificate("test", "test", "DE", "test") + configuration, _ := api.NewConfiguration( + "test", "test", "test", "test", + []shipapi.DeviceCategoryType{shipapi.DeviceCategoryTypeEnergyManagementSystem}, + model.DeviceTypeTypeEnergyManagementSystem, + []model.EntityTypeType{model.EntityTypeTypeInverter}, + 9999, cert, time.Second*4) + + serviceHandler := mocks.NewServiceReaderInterface(s.T()) + serviceHandler.EXPECT().ServicePairingDetailUpdate(mock.Anything, mock.Anything).Return().Maybe() + + s.service = service.NewService(configuration, serviceHandler) + _ = s.service.Setup() + + mockRemoteDevice := spinemocks.NewDeviceRemoteInterface(s.T()) + s.mockRemoteEntity = spinemocks.NewEntityRemoteInterface(s.T()) + mockRemoteFeature := spinemocks.NewFeatureRemoteInterface(s.T()) + mockRemoteDevice.EXPECT().FeatureByEntityTypeAndRole(mock.Anything, mock.Anything, mock.Anything).Return(mockRemoteFeature).Maybe() + mockRemoteDevice.EXPECT().Ski().Return(remoteSki).Maybe() + s.mockRemoteEntity.EXPECT().Device().Return(mockRemoteDevice).Maybe() + s.mockRemoteEntity.EXPECT().EntityType().Return(mock.Anything).Maybe() + entityAddress := &model.EntityAddressType{} + s.mockRemoteEntity.EXPECT().Address().Return(entityAddress).Maybe() + mockRemoteFeature.EXPECT().DataCopy(mock.Anything).Return(mock.Anything).Maybe() + mockRemoteFeature.EXPECT().Address().Return(&model.FeatureAddressType{}).Maybe() + mockRemoteFeature.EXPECT().Operations().Return(nil).Maybe() + + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + s.sut = NewMPC(localEntity, s.Event) + s.sut.AddFeatures() + s.sut.AddUseCase() + + //s.remoteDevice, s.monitoredEntity = setupDevices(s.service, s.T()) +} diff --git a/usecases/mu/mpc/types.go b/usecases/mu/mpc/types.go new file mode 100644 index 00000000..67f2d3f0 --- /dev/null +++ b/usecases/mu/mpc/types.go @@ -0,0 +1,10 @@ +package mpc + +import "github.com/enbility/eebus-go/api" + +const ( + // Update of the list of remote entities supporting the Use Case + // + // Use `RemoteEntities` to get the current data + UseCaseSupportUpdate api.EventType = "mu-mpc-UseCaseSupportUpdate" +) diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go new file mode 100644 index 00000000..e027ada9 --- /dev/null +++ b/usecases/mu/mpc/usecase.go @@ -0,0 +1,400 @@ +package mpc + +import ( + "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/features/server" + ucapi "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/eebus-go/usecases/usecase" + spineapi "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/spine" + "github.com/enbility/spine-go/util" + "time" +) + +type MPC struct { + *usecase.UseCaseBase + + acPowerTotal *model.MeasurementIdType + acPower [3]*model.MeasurementIdType + acEnergyConsumed *model.MeasurementIdType + acEnergyProduced *model.MeasurementIdType + acCurrent [3]*model.MeasurementIdType + acVoltage [3]*model.MeasurementIdType // Phase to phase voltages are not supported (yet) + acFrequency *model.MeasurementIdType +} + +var _ ucapi.MuMPCInterface = (*MPC)(nil) + +// At the moment the MPC use case configures itself as a 3-phase meter by default (ABC). +func NewMPC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback) *MPC { + validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeMonitoringAppliance} + var validEntityTypes []model.EntityTypeType = nil // all entity types are valid + useCaseScenarios := []api.UseCaseScenario{ + { + Scenario: model.UseCaseScenarioSupportType(1), + Mandatory: true, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeElectricalConnection, + model.FeatureTypeTypeMeasurement, + }, + }, + { + Scenario: model.UseCaseScenarioSupportType(2), + Mandatory: false, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeElectricalConnection, + model.FeatureTypeTypeMeasurement, + }, + }, + { + Scenario: model.UseCaseScenarioSupportType(3), + Mandatory: false, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeElectricalConnection, + model.FeatureTypeTypeMeasurement, + }, + }, + { + Scenario: model.UseCaseScenarioSupportType(4), + Mandatory: false, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeElectricalConnection, + model.FeatureTypeTypeMeasurement, + }, + }, + { + Scenario: model.UseCaseScenarioSupportType(5), + Mandatory: false, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeElectricalConnection, + model.FeatureTypeTypeMeasurement, + }, + }, + } + + u := usecase.NewUseCaseBase( + localEntity, + model.UseCaseActorTypeMonitoredUnit, + model.UseCaseNameTypeMonitoringOfPowerConsumption, + "1.0.0", + "release", + useCaseScenarios, + eventCB, + UseCaseSupportUpdate, + validActorTypes, + validEntityTypes) + + uc := &MPC{ + UseCaseBase: u, + } + + _ = spine.Events.Subscribe(uc) + + return uc +} + +func (e *MPC) AddFeatures() { + // server features + f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) + f.AddFunctionType(model.FunctionTypeElectricalConnectionDescriptionListData, true, false) + f.AddFunctionType(model.FunctionTypeElectricalConnectionParameterDescriptionListData, true, false) + + f = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) + f.AddFunctionType(model.FunctionTypeMeasurementDescriptionListData, true, false) + f.AddFunctionType(model.FunctionTypeMeasurementConstraintsListData, true, false) + f.AddFunctionType(model.FunctionTypeMeasurementListData, true, false) + + measurements, err := server.NewMeasurement(e.LocalEntity) + if err != nil { + panic(err) + } + + e.acPowerTotal = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeW), + ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), + }) + + for id := 0; id < len(e.acPower); id++ { + e.acPower[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeW), + ScopeType: util.Ptr(model.ScopeTypeTypeACPower), + }) + } + + e.acEnergyConsumed = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeWh), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), + }) + + e.acEnergyProduced = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeWh), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), + }) + + for id := 0; id < len(e.acCurrent); id++ { + e.acCurrent[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeA), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + }) + } + + for id := 0; id < len(e.acVoltage); id++ { + e.acVoltage[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + } + + e.acFrequency = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeHz), + ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), + }) + + electricalConnection, err := server.NewElectricalConnection(e.LocalEntity) + if err != nil { + panic(err) + } + + idEc1 := model.ElectricalConnectionIdType(0) + ec1 := model.ElectricalConnectionDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + PowerSupplyType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + PositiveEnergyDirection: util.Ptr(model.EnergyDirectionTypeConsume), + } + if err := electricalConnection.AddDescription(ec1); err != nil { + panic(err) + } + + p1 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acPowerTotal, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeAbc), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP1 := electricalConnection.AddParameterDescription(p1) + if idP1 == nil { + panic("error adding parameter description") + } + + p21 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acPower[0], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP21 := electricalConnection.AddParameterDescription(p21) + if idP21 == nil { + panic("error adding parameter description") + } + + p22 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acPower[1], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP22 := electricalConnection.AddParameterDescription(p22) + if idP22 == nil { + panic("error adding parameter description") + } + + p23 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acPower[2], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP23 := electricalConnection.AddParameterDescription(p23) + if idP23 == nil { + panic("error adding parameter description") + } + + p3 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acEnergyConsumed, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + } + idP3 := electricalConnection.AddParameterDescription(p3) + if idP3 == nil { + panic("error adding parameter description") + } + + p4 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acEnergyProduced, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + } + idP4 := electricalConnection.AddParameterDescription(p4) + if idP4 == nil { + panic("error adding parameter description") + } + + p51 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acCurrent[0], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP51 := electricalConnection.AddParameterDescription(p51) + if idP51 == nil { + panic("error adding parameter description") + } + + p52 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acCurrent[1], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP52 := electricalConnection.AddParameterDescription(p52) + if idP52 == nil { + panic("error adding parameter description") + } + + p53 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acCurrent[2], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP53 := electricalConnection.AddParameterDescription(p53) + if idP53 == nil { + panic("error adding parameter description") + } + + p61 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acVoltage[0], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP61 := electricalConnection.AddParameterDescription(p61) + if idP61 == nil { + panic("error adding parameter description") + } + + p62 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acVoltage[1], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP62 := electricalConnection.AddParameterDescription(p62) + if idP62 == nil { + panic("error adding parameter description") + } + + p63 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acVoltage[2], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP63 := electricalConnection.AddParameterDescription(p63) + if idP63 == nil { + panic("error adding parameter description") + } + + p7 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acFrequency, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + } + idP7 := electricalConnection.AddParameterDescription(p7) + if idP7 == nil { + panic("error adding parameter description") + } + + for _, id := range []*model.MeasurementIdType{ + e.acPowerTotal, + e.acPower[0], e.acPower[1], e.acPower[2], + e.acEnergyConsumed, + e.acEnergyProduced, + e.acCurrent[0], e.acCurrent[1], e.acCurrent[2], + e.acVoltage[0], e.acVoltage[1], e.acVoltage[2], + e.acFrequency} { + if err := e.setMeasurementDataForId(id, 0); err != nil { + panic(err) + } + } +} + +func (e *MPC) setMeasurementDataForId(id *model.MeasurementIdType, measurementData float64) error { + measurements, err := server.NewMeasurement(e.LocalEntity) + if err != nil { + return err + } + + err = measurements.UpdateDataForId(model.MeasurementDataType{ + MeasurementId: id, + ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), + Timestamp: model.NewAbsoluteOrRelativeTimeTypeFromTime(time.Now()), + Value: model.NewScaledNumberType(measurementData), + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueState: util.Ptr(model.MeasurementValueStateTypeNormal), + }, nil, *id) + + return err +} + +func (e *MPC) getMeasurementDataForId(id *model.MeasurementIdType) (float64, error) { + measurements, err := server.NewMeasurement(e.LocalEntity) + if err != nil { + return 0, err + } + + data, err := measurements.GetDataForId(*id) + if err != nil { + return 0, err + } + + if data == nil { + return 0, api.ErrDataNotAvailable + } + + return data.Value.GetValue(), nil +} diff --git a/usecases/usecase/events.go b/usecases/usecase/events.go index 73c62cbc..7537bbbf 100644 --- a/usecases/usecase/events.go +++ b/usecases/usecase/events.go @@ -91,7 +91,7 @@ func (u *UseCaseBase) useCaseDataUpdate( } for _, entity := range entitiesToCheck { - if !slices.Contains(u.validEntityTypes, entity.EntityType()) { + if u.validEntityTypes != nil && !slices.Contains(u.validEntityTypes, entity.EntityType()) { continue } diff --git a/usecases/usecase/usecase.go b/usecases/usecase/usecase.go index 1d388866..e4650866 100644 --- a/usecases/usecase/usecase.go +++ b/usecases/usecase/usecase.go @@ -25,7 +25,7 @@ type UseCaseBase struct { availableEntityScenarios []api.RemoteEntityScenarios // map of scenarios and their availability for each compatible remote entity validActorTypes []model.UseCaseActorType // valid remote actor types for this use case - validEntityTypes []model.EntityTypeType // valid remote entity types for this use case + validEntityTypes []model.EntityTypeType // valid remote entity types for this use case (if nil all are valid) mux sync.Mutex } @@ -113,6 +113,10 @@ func (u *UseCaseBase) IsCompatibleEntityType(entity spineapi.EntityRemoteInterfa return false } + if u.validEntityTypes == nil { + return true + } + return slices.Contains(u.validEntityTypes, entity.EntityType()) } From 173c2814f5caa3eb435d45c3be4a126e2e7ca888 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Mon, 14 Oct 2024 09:02:10 +0200 Subject: [PATCH 02/61] Add and use allEntityTypesValid boolean instead of nil validEntityTypes --- usecases/cem/cevc/usecase.go | 1 + usecases/cem/evcc/usecase.go | 1 + usecases/cem/evcem/usecase.go | 4 +++- usecases/cem/evsecc/usecase.go | 4 +++- usecases/cem/evsoc/usecase.go | 1 + usecases/cem/opev/usecase.go | 1 + usecases/cem/oscev/usecase.go | 1 + usecases/cem/vabd/usecase.go | 1 + usecases/cem/vapd/usecase.go | 1 + usecases/cs/lpc/usecase.go | 1 + usecases/cs/lpp/usecase.go | 1 + usecases/eg/lpc/usecase.go | 1 + usecases/eg/lpp/usecase.go | 4 +++- usecases/ma/mgcp/usecase.go | 4 +++- usecases/ma/mpc/usecase.go | 4 +++- usecases/mu/mpc/usecase.go | 8 +++++--- usecases/usecase/events.go | 2 +- usecases/usecase/testhelper_test.go | 1 + usecases/usecase/usecase.go | 10 +++++++--- 19 files changed, 39 insertions(+), 12 deletions(-) diff --git a/usecases/cem/cevc/usecase.go b/usecases/cem/cevc/usecase.go index 72186c32..96ef2e1e 100644 --- a/usecases/cem/cevc/usecase.go +++ b/usecases/cem/cevc/usecase.go @@ -69,6 +69,7 @@ func NewCEVC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC UseCaseSupportUpdate, validActorTypes, validEntityTypes, + false, ) uc := &CEVC{ diff --git a/usecases/cem/evcc/usecase.go b/usecases/cem/evcc/usecase.go index de647580..c34588c0 100644 --- a/usecases/cem/evcc/usecase.go +++ b/usecases/cem/evcc/usecase.go @@ -82,6 +82,7 @@ func NewEVCC( UseCaseSupportUpdate, validActorTypes, validEntityTypes, + false, ) uc := &EVCC{ diff --git a/usecases/cem/evcem/usecase.go b/usecases/cem/evcem/usecase.go index bb76eb83..93f42ef3 100644 --- a/usecases/cem/evcem/usecase.go +++ b/usecases/cem/evcem/usecase.go @@ -68,7 +68,9 @@ func NewEVCEM( eventCB, UseCaseSupportUpdate, validActorTypes, - validEntityTypes) + validEntityTypes, + false, + ) uc := &EVCEM{ UseCaseBase: usecase, diff --git a/usecases/cem/evsecc/usecase.go b/usecases/cem/evsecc/usecase.go index 7f41137a..8c4f054c 100644 --- a/usecases/cem/evsecc/usecase.go +++ b/usecases/cem/evsecc/usecase.go @@ -50,7 +50,9 @@ func NewEVSECC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEven eventCB, UseCaseSupportUpdate, validActorTypes, - validEntityTypes) + validEntityTypes, + false, + ) uc := &EVSECC{ UseCaseBase: usecase, diff --git a/usecases/cem/evsoc/usecase.go b/usecases/cem/evsoc/usecase.go index 975a7dbc..0d11a174 100644 --- a/usecases/cem/evsoc/usecase.go +++ b/usecases/cem/evsoc/usecase.go @@ -46,6 +46,7 @@ func NewEVSOC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEvent UseCaseSupportUpdate, validActorTypes, validEntityTypes, + false, ) uc := &EVSOC{ diff --git a/usecases/cem/opev/usecase.go b/usecases/cem/opev/usecase.go index 272fdea3..d60dd7cc 100644 --- a/usecases/cem/opev/usecase.go +++ b/usecases/cem/opev/usecase.go @@ -57,6 +57,7 @@ func NewOPEV(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC UseCaseSupportUpdate, validActorTypes, validEntityTypes, + false, ) uc := &OPEV{ diff --git a/usecases/cem/oscev/usecase.go b/usecases/cem/oscev/usecase.go index 91411664..a8b44a76 100644 --- a/usecases/cem/oscev/usecase.go +++ b/usecases/cem/oscev/usecase.go @@ -57,6 +57,7 @@ func NewOSCEV(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEvent UseCaseSupportUpdate, validActorTypes, validEntityTypes, + false, ) uc := &OSCEV{ diff --git a/usecases/cem/vabd/usecase.go b/usecases/cem/vabd/usecase.go index a4ccd22e..edb8fd9a 100644 --- a/usecases/cem/vabd/usecase.go +++ b/usecases/cem/vabd/usecase.go @@ -71,6 +71,7 @@ func NewVABD(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC UseCaseSupportUpdate, validActorTypes, validEntityTypes, + false, ) uc := &VABD{ diff --git a/usecases/cem/vapd/usecase.go b/usecases/cem/vapd/usecase.go index 10b27f8d..4780a4df 100644 --- a/usecases/cem/vapd/usecase.go +++ b/usecases/cem/vapd/usecase.go @@ -62,6 +62,7 @@ func NewVAPD(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC UseCaseSupportUpdate, validActorTypes, validEntityTypes, + false, ) uc := &VAPD{ diff --git a/usecases/cs/lpc/usecase.go b/usecases/cs/lpc/usecase.go index f897ad54..959590c2 100644 --- a/usecases/cs/lpc/usecase.go +++ b/usecases/cs/lpc/usecase.go @@ -76,6 +76,7 @@ func NewLPC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCa UseCaseSupportUpdate, validActorTypes, validEntityTypes, + false, ) uc := &LPC{ diff --git a/usecases/cs/lpp/usecase.go b/usecases/cs/lpp/usecase.go index 1087bc4d..aeb79898 100644 --- a/usecases/cs/lpp/usecase.go +++ b/usecases/cs/lpp/usecase.go @@ -75,6 +75,7 @@ func NewLPP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCa UseCaseSupportUpdate, validActorTypes, validEntityTypes, + false, ) uc := &LPP{ diff --git a/usecases/eg/lpc/usecase.go b/usecases/eg/lpc/usecase.go index 20081961..1885003d 100644 --- a/usecases/eg/lpc/usecase.go +++ b/usecases/eg/lpc/usecase.go @@ -65,6 +65,7 @@ func NewLPC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCa UseCaseSupportUpdate, validActorTypes, validEntityTypes, + false, ) uc := &LPC{ diff --git a/usecases/eg/lpp/usecase.go b/usecases/eg/lpp/usecase.go index 192c78ac..34710332 100644 --- a/usecases/eg/lpp/usecase.go +++ b/usecases/eg/lpp/usecase.go @@ -62,7 +62,9 @@ func NewLPP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCa eventCB, UseCaseSupportUpdate, validActorTypes, - validEntityTypes) + validEntityTypes, + false, + ) uc := &LPP{ UseCaseBase: usecase, diff --git a/usecases/ma/mgcp/usecase.go b/usecases/ma/mgcp/usecase.go index 17f554b5..0b9ae005 100644 --- a/usecases/ma/mgcp/usecase.go +++ b/usecases/ma/mgcp/usecase.go @@ -92,7 +92,9 @@ func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC eventCB, UseCaseSupportUpdate, validActorTypes, - validEntityTypes) + validEntityTypes, + false, + ) uc := &MGCP{ UseCaseBase: usecase, diff --git a/usecases/ma/mpc/usecase.go b/usecases/ma/mpc/usecase.go index a7861104..baa3ecb5 100644 --- a/usecases/ma/mpc/usecase.go +++ b/usecases/ma/mpc/usecase.go @@ -84,7 +84,9 @@ func NewMPC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCa eventCB, UseCaseSupportUpdate, validActorTypes, - validEntityTypes) + validEntityTypes, + false, + ) uc := &MPC{ UseCaseBase: usecase, diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index e027ada9..d5ad36a3 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -1,6 +1,8 @@ package mpc import ( + "time" + "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" ucapi "github.com/enbility/eebus-go/usecases/api" @@ -9,7 +11,6 @@ import ( "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/spine" "github.com/enbility/spine-go/util" - "time" ) type MPC struct { @@ -29,7 +30,6 @@ var _ ucapi.MuMPCInterface = (*MPC)(nil) // At the moment the MPC use case configures itself as a 3-phase meter by default (ABC). func NewMPC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback) *MPC { validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeMonitoringAppliance} - var validEntityTypes []model.EntityTypeType = nil // all entity types are valid useCaseScenarios := []api.UseCaseScenario{ { Scenario: model.UseCaseScenarioSupportType(1), @@ -83,7 +83,9 @@ func NewMPC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCa eventCB, UseCaseSupportUpdate, validActorTypes, - validEntityTypes) + nil, + true, + ) uc := &MPC{ UseCaseBase: u, diff --git a/usecases/usecase/events.go b/usecases/usecase/events.go index 7537bbbf..eef8137a 100644 --- a/usecases/usecase/events.go +++ b/usecases/usecase/events.go @@ -91,7 +91,7 @@ func (u *UseCaseBase) useCaseDataUpdate( } for _, entity := range entitiesToCheck { - if u.validEntityTypes != nil && !slices.Contains(u.validEntityTypes, entity.EntityType()) { + if !u.allEntityTypesValid && !slices.Contains(u.validEntityTypes, entity.EntityType()) { continue } diff --git a/usecases/usecase/testhelper_test.go b/usecases/usecase/testhelper_test.go index 3579a95d..68653235 100644 --- a/usecases/usecase/testhelper_test.go +++ b/usecases/usecase/testhelper_test.go @@ -110,6 +110,7 @@ func (s *UseCaseSuite) BeforeTest(suiteName, testName string) { useCaseUpdateEvent, validActorTypes, validEntityTypes, + false, ) } diff --git a/usecases/usecase/usecase.go b/usecases/usecase/usecase.go index e4650866..039b0ada 100644 --- a/usecases/usecase/usecase.go +++ b/usecases/usecase/usecase.go @@ -24,8 +24,9 @@ type UseCaseBase struct { availableEntityScenarios []api.RemoteEntityScenarios // map of scenarios and their availability for each compatible remote entity - validActorTypes []model.UseCaseActorType // valid remote actor types for this use case - validEntityTypes []model.EntityTypeType // valid remote entity types for this use case (if nil all are valid) + validActorTypes []model.UseCaseActorType // valid remote actor types for this use case + validEntityTypes []model.EntityTypeType // valid remote entity types for this use case + allEntityTypesValid bool mux sync.Mutex } @@ -56,6 +57,7 @@ func NewUseCaseBase( useCaseUpdateEvent api.EventType, validActorTypes []model.UseCaseActorType, validEntityTypes []model.EntityTypeType, + allEntityTypesValid bool, ) *UseCaseBase { ucb := &UseCaseBase{ LocalEntity: localEntity, @@ -68,6 +70,7 @@ func NewUseCaseBase( useCaseUpdateEvent: useCaseUpdateEvent, validActorTypes: validActorTypes, validEntityTypes: validEntityTypes, + allEntityTypesValid: allEntityTypesValid, } _ = localEntity.Device().Events().Subscribe(ucb) @@ -110,10 +113,11 @@ func (u *UseCaseBase) UpdateUseCaseAvailability(available bool) { func (u *UseCaseBase) IsCompatibleEntityType(entity spineapi.EntityRemoteInterface) bool { if entity == nil { + return false } - if u.validEntityTypes == nil { + if u.allEntityTypesValid { return true } From 4808cc89f2e98a6498280f8ed9be88a7051c0043 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Fri, 11 Oct 2024 10:42:09 +0200 Subject: [PATCH 03/61] Update MPC to allow for updating multiple data points in one step Implements the new approach added by #115 to allow setting measurement values independently or at the same time --- usecases/api/mu_mpc.go | 69 -------- usecases/mu/mpc/public.go | 307 ++++++++++++++++++++++++++------- usecases/mu/mpc/public_test.go | 65 ++++++- usecases/mu/mpc/usecase.go | 51 ++---- 4 files changed, 317 insertions(+), 175 deletions(-) delete mode 100644 usecases/api/mu_mpc.go diff --git a/usecases/api/mu_mpc.go b/usecases/api/mu_mpc.go deleted file mode 100644 index 24145d24..00000000 --- a/usecases/api/mu_mpc.go +++ /dev/null @@ -1,69 +0,0 @@ -package api - -import ( - "github.com/enbility/eebus-go/api" -) - -// Actor: Monitoring Unit -// UseCase: Monitoring of Power Consumption -type MuMPCInterface interface { - api.UseCaseInterface - - // Scenario 1 - - // set the momentary active power consumption or production - // - // parameters: - // - power: the active power - SetPower(power float64) error - - // set the momentary active phase specific power consumption or production per phase - // - // parameters: - // - phaseA: the active power of phase A - // - phaseB: the active power of phase B - // - phaseC: the active power of phase C - SetPowerPerPhase(phaseA, phaseB, phaseC float64) error - - // Scenario 2 - - // set the total consumption energy - // - // parameters: - // - consumed: the total consumption energy - SetEnergyConsumed(consumed float64) error - - // set the total feed in energy - // - // parameters: - // - produced: the total feed in energy - SetEnergyProduced(produced float64) error - - // Scenario 3 - - // set the momentary phase specific current consumption or production - // - // parameters: - // - phaseA: the current of phase A - // - phaseB: the current of phase B - // - phaseC: the current of phase C - SetCurrentPerPhase(phaseA, phaseB, phaseC float64) error - - // Scenario 4 - - // set the phase specific voltage details - // - // parameters: - // - phaseA: the voltage of phase A - // - phaseB: the voltage of phase B - // - phaseC: the voltage of phase C - SetVoltagePerPhase(phaseA, phaseB, phaseC float64) error - - // Scenario 5 - - // set frequency - // - // parameters: - // - frequency: the frequency - SetFrequency(frequency float64) error -} diff --git a/usecases/mu/mpc/public.go b/usecases/mu/mpc/public.go index 46f95935..a19b857a 100644 --- a/usecases/mu/mpc/public.go +++ b/usecases/mu/mpc/public.go @@ -2,159 +2,340 @@ package mpc import ( "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/features/server" ) +// ------------------------- Getters ------------------------- // + // Scenario 1 -// set the momentary active power consumption or production +// get the momentary active power consumption or production // // possible errors: // - ErrMissingData if the id is not available // - and others -func (e *MPC) SetPower(power float64) error { +func (e *MPC) Power() (float64, error) { if e.acPowerTotal == nil { - return api.ErrMissingData - } - - err := e.setMeasurementDataForId(e.acPowerTotal, power) - if err != nil { - return err + return 0, api.ErrMissingData } - return nil + return e.getMeasurementDataForId(e.acPowerTotal) } -// set the momentary active power consumption or production per phase +// get the momentary active power consumption or production per phase // // possible errors: // - ErrMissingData if the id is not available // - and others -func (e *MPC) SetPowerPerPhase(phaseA, phaseB, phaseC float64) error { +func (e *MPC) PowerPerPhase() ([]float64, error) { if e.acPower[0] == nil || e.acPower[1] == nil || e.acPower[2] == nil { - return api.ErrMissingData + return nil, api.ErrMissingData } - err := e.setMeasurementDataForId(e.acPower[0], phaseA) + phaseA, err := e.getMeasurementDataForId(e.acPower[0]) if err != nil { - return err + return nil, err } - err = e.setMeasurementDataForId(e.acPower[1], phaseB) + phaseB, err := e.getMeasurementDataForId(e.acPower[1]) if err != nil { - return err + return nil, err } - err = e.setMeasurementDataForId(e.acPower[2], phaseC) + phaseC, err := e.getMeasurementDataForId(e.acPower[2]) if err != nil { - return err + return nil, err } - return nil + return []float64{phaseA, phaseB, phaseC}, nil } // Scenario 2 -// set the total consumption energy +// get the total feed in energy // -// - positive values are used for consumption -func (e *MPC) SetEnergyConsumed(energy float64) error { +// - negative values are used for production +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (e *MPC) EnergyConsumed() (float64, error) { if e.acEnergyConsumed == nil { - return api.ErrMissingData - } - - err := e.setMeasurementDataForId(e.acEnergyConsumed, energy) - if err != nil { - return err + return 0, api.ErrMissingData } - return nil + return e.getMeasurementDataForId(e.acEnergyConsumed) } -// set the total feed in energy +// get the total feed in energy // // - negative values are used for production -func (e *MPC) SetEnergyProduced(energy float64) error { +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (e *MPC) EnergyProduced() (float64, error) { if e.acEnergyProduced == nil { - return api.ErrMissingData + return 0, api.ErrMissingData } - err := e.setMeasurementDataForId(e.acEnergyProduced, energy) - if err != nil { - return err - } - - return nil + return e.getMeasurementDataForId(e.acEnergyProduced) } // Scenario 3 -// set the momentary phase specific current consumption or production +// get the momentary phase specific current consumption or production // // - positive values are used for consumption // - negative values are used for production -func (e *MPC) SetCurrentPerPhase(phaseA, phaseB, phaseC float64) error { +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (e *MPC) CurrentPerPhase() ([]float64, error) { if e.acCurrent[0] == nil || e.acCurrent[1] == nil || e.acCurrent[2] == nil { - return api.ErrMissingData + return nil, api.ErrMissingData } - err := e.setMeasurementDataForId(e.acCurrent[0], phaseA) + phaseA, err := e.getMeasurementDataForId(e.acCurrent[0]) if err != nil { - return err + return nil, err } - err = e.setMeasurementDataForId(e.acCurrent[1], phaseB) + phaseB, err := e.getMeasurementDataForId(e.acCurrent[1]) if err != nil { - return err + return nil, err } - err = e.setMeasurementDataForId(e.acCurrent[2], phaseC) + phaseC, err := e.getMeasurementDataForId(e.acCurrent[2]) if err != nil { - return err + return nil, err } - return nil + return []float64{phaseA, phaseB, phaseC}, nil } // Scenario 4 -// set the phase specific voltage details -func (e *MPC) SetVoltagePerPhase(phaseA, phaseB, phaseC float64) error { +// get the phase specific voltage details +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (e *MPC) VoltagePerPhase() ([]float64, error) { for _, id := range e.acVoltage { if id == nil { - return api.ErrMissingData + return nil, api.ErrMissingData } } - err := e.setMeasurementDataForId(e.acVoltage[0], phaseA) + phaseA, err := e.getMeasurementDataForId(e.acVoltage[0]) if err != nil { - return err + return nil, err } - err = e.setMeasurementDataForId(e.acVoltage[1], phaseB) + phaseB, err := e.getMeasurementDataForId(e.acVoltage[1]) if err != nil { - return err + return nil, err } - err = e.setMeasurementDataForId(e.acVoltage[2], phaseC) + phaseC, err := e.getMeasurementDataForId(e.acVoltage[2]) if err != nil { - return err + return nil, err + } + + phaseAToB, err := e.getMeasurementDataForId(e.acVoltage[3]) + if err != nil { + return nil, err + } + + phaseBToC, err := e.getMeasurementDataForId(e.acVoltage[4]) + if err != nil { + return nil, err + } + + phaseCToA, err := e.getMeasurementDataForId(e.acVoltage[5]) + if err != nil { + return nil, err } - return nil + return []float64{phaseA, phaseB, phaseC, phaseAToB, phaseBToC, phaseCToA}, nil } // Scenario 5 -// SetFrequency set frequency -func (e *MPC) SetFrequency(frequency float64) error { +// get frequency +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (e *MPC) Frequency() (float64, error) { if e.acFrequency == nil { - return api.ErrMissingData + return 0, api.ErrMissingData + } + + return e.getMeasurementDataForId(e.acFrequency) +} + +// ------------------------- Setters ------------------------- // + +// Scenario 1 + +// use MPC.MeasuredAcPowerTotal in MPC.Update to set the momentary active power consumption or production +func (e *MPC) MeasuredAcPowerTotal(acPowerTotal float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(acPowerTotal), + Id: *e.acPowerTotal, } +} + +// use MPC.MeasuredAcPowerPhaseA in MPC.Update to set the momentary active power consumption or production per phase +func (e *MPC) MeasuredAcPowerPhaseA(acPowerPhaseA float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(acPowerPhaseA), + Id: *e.acPower[0], + } +} + +// use MPC.MeasuredAcPowerPhaseB in MPC.Update to set the momentary active power consumption or production per phase +func (e *MPC) MeasuredAcPowerPhaseB(acPowerPhaseB float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(acPowerPhaseB), + Id: *e.acPower[1], + } +} + +// use MPC.MeasuredAcPowerPhaseC in MPC.Update to set the momentary active power consumption or production per phase +func (e *MPC) MeasuredAcPowerPhaseC(acPowerPhaseC float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(acPowerPhaseC), + Id: *e.acPower[2], + } +} + +// Scenario 2 + +// use MPC.MeasuredAcEnergyConsumed in MPC.Update to set the total feed in energy +func (e *MPC) MeasuredAcEnergyConsumed(energyConsumed float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(energyConsumed), + Id: *e.acEnergyConsumed, + } +} + +// use MPC.MeasuredAcEnergyProduced in MPC.Update to set the total feed in energy +func (e *MPC) MeasuredAcEnergyProduced(energyProduced float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(energyProduced), + Id: *e.acEnergyProduced, + } +} + +// Scenario 3 + +// use MPC.MeasuredAcCurrentPhaseA in MPC.Update to set the momentary phase specific current consumption or production +func (e *MPC) MeasuredAcCurrentPhaseA(acCurrentPhaseA float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(acCurrentPhaseA), + Id: *e.acCurrent[0], + } +} + +// use MPC.MeasuredAcCurrentPhaseB in MPC.Update to set the momentary phase specific current consumption or production +func (e *MPC) MeasuredAcCurrentPhaseB(acCurrentPhaseB float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(acCurrentPhaseB), + Id: *e.acCurrent[1], + } +} + +// use MPC.MeasuredAcCurrentPhaseC in MPC.Update to set the momentary phase specific current consumption or production +func (e *MPC) MeasuredAcCurrentPhaseC(acCurrentPhaseC float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(acCurrentPhaseC), + Id: *e.acCurrent[2], + } +} + +// Scenario 4 + +// use MPC.MeasuredAcVoltagePhaseA in MPC.Update to set the phase specific voltage details +func (e *MPC) MeasuredAcVoltagePhaseA(voltagePhaseA float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(voltagePhaseA), + Id: *e.acVoltage[0], + } +} + +// use MPC.MeasuredAcVoltagePhaseB in MPC.Update to set the phase specific voltage details +func (e *MPC) MeasuredAcVoltagePhaseB(voltagePhaseB float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(voltagePhaseB), + Id: *e.acVoltage[1], + } +} + +// use MPC.MeasuredAcVoltagePhaseC in MPC.Update to set the phase specific voltage details +func (e *MPC) MeasuredAcVoltagePhaseC(voltagePhaseC float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(voltagePhaseC), + Id: *e.acVoltage[2], + } +} + +// use MPC.MeasuredAcVoltagePhaseAToB in MPC.Update to set the phase specific voltage details +func (e *MPC) MeasuredAcVoltagePhaseAToB(voltagePhaseAToB float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(voltagePhaseAToB), + Id: *e.acVoltage[3], + } +} + +// use MPC.MeasuredAcVoltagePhaseBToC in MPC.Update to set the phase specific voltage details +func (e *MPC) MeasuredAcVoltagePhaseBToC(voltagePhaseBToC float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(voltagePhaseBToC), + Id: *e.acVoltage[4], + } +} + +// use MPC.MeasuredAcVoltagePhaseCToA in MPC.Update to set the phase specific voltage details +func (e *MPC) MeasuredAcVoltagePhaseCToA(voltagePhaseCToA float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(voltagePhaseCToA), + Id: *e.acVoltage[5], + } +} - err := e.setMeasurementDataForId(e.acFrequency, frequency) +// Scenario 5 + +// use MPC.MeasuredAcFrequency in MPC.Update to set the frequency +func (e *MPC) MeasuredAcFrequency(frequency float64) api.MeasurementDataForID { + return api.MeasurementDataForID{ + Data: measuredValue(frequency), + Id: *e.acFrequency, + } +} + +// Update the measurement data + +// use MPC.Update to update the measurement data +// use it like this: +// +// mpc.Update( +// mpc.MeasuredAcPowerTotal(1000), +// mpc.MeasuredAcPowerPhaseA(500), +// ... +// ) +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (e *MPC) Update(measurementDataForIds ...api.MeasurementDataForID) error { + measurements, err := server.NewMeasurement(e.LocalEntity) if err != nil { return err } - return nil + return measurements.UpdateDataForIds(measurementDataForIds) } diff --git a/usecases/mu/mpc/public_test.go b/usecases/mu/mpc/public_test.go index decee094..a09a2fa6 100644 --- a/usecases/mu/mpc/public_test.go +++ b/usecases/mu/mpc/public_test.go @@ -5,36 +5,87 @@ import ( ) func (s *MuMPCSuite) Test_Power() { - err := s.sut.SetPower(5.0) + err := s.sut.Update( + s.sut.MeasuredAcPowerTotal(5.0), + ) assert.Nil(s.T(), err) + + power, err := s.sut.Power() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, power) } func (s *MuMPCSuite) Test_PowerPerPhase() { - err := s.sut.SetPowerPerPhase(5.0, 5.0, 5.0) + err := s.sut.Update( + s.sut.MeasuredAcPowerPhaseA(5.0), + s.sut.MeasuredAcPowerPhaseB(6.0), + s.sut.MeasuredAcPowerPhaseC(7.0), + ) + assert.Nil(s.T(), err) + + powerPerPhases, err := s.sut.PowerPerPhase() assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 6.0, 7.0}, powerPerPhases) } func (s *MuMPCSuite) Test_EnergyConsumed() { - err := s.sut.SetEnergyConsumed(5.0) + err := s.sut.Update( + s.sut.MeasuredAcEnergyConsumed(5.0), + ) assert.Nil(s.T(), err) + + energyConsumed, err := s.sut.EnergyConsumed() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, energyConsumed) } func (s *MuMPCSuite) Test_EnergyProduced() { - err := s.sut.SetEnergyProduced(5.0) + err := s.sut.Update( + s.sut.MeasuredAcEnergyProduced(5.0), + ) + assert.Nil(s.T(), err) + + energyProduced, err := s.sut.EnergyProduced() assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, energyProduced) } func (s *MuMPCSuite) Test_CurrentPerPhase() { - err := s.sut.SetCurrentPerPhase(5.0, 5.0, 5.0) + err := s.sut.Update( + s.sut.MeasuredAcCurrentPhaseA(5.0), + s.sut.MeasuredAcCurrentPhaseB(5.0), + s.sut.MeasuredAcCurrentPhaseC(5.0), + ) + assert.Nil(s.T(), err) + + currentPerPhases, err := s.sut.CurrentPerPhase() assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 5.0, 5.0}, currentPerPhases) } func (s *MuMPCSuite) Test_VoltagePerPhase() { - err := s.sut.SetVoltagePerPhase(5.0, 5.0, 5.0) + err := s.sut.Update( + s.sut.MeasuredAcVoltagePhaseA(5.0), + s.sut.MeasuredAcVoltagePhaseB(6.0), + s.sut.MeasuredAcVoltagePhaseC(7.0), + s.sut.MeasuredAcVoltagePhaseAToB(8.0), + s.sut.MeasuredAcVoltagePhaseBToC(9.0), + s.sut.MeasuredAcVoltagePhaseCToA(10.0), + ) assert.Nil(s.T(), err) + + voltagePerPhases, err := s.sut.VoltagePerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, voltagePerPhases) } func (s *MuMPCSuite) Test_Frequency() { - err := s.sut.SetFrequency(5.0) + err := s.sut.Update( + s.sut.MeasuredAcFrequency(5.0), + ) + assert.Nil(s.T(), err) + + frequency, err := s.sut.Frequency() assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, frequency) } diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index d5ad36a3..46dade50 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -5,7 +5,6 @@ import ( "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" - ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/eebus-go/usecases/usecase" spineapi "github.com/enbility/spine-go/api" "github.com/enbility/spine-go/model" @@ -21,14 +20,15 @@ type MPC struct { acEnergyConsumed *model.MeasurementIdType acEnergyProduced *model.MeasurementIdType acCurrent [3]*model.MeasurementIdType - acVoltage [3]*model.MeasurementIdType // Phase to phase voltages are not supported (yet) + acVoltage [6]*model.MeasurementIdType // Phase to phase voltages are not supported (yet) acFrequency *model.MeasurementIdType } -var _ ucapi.MuMPCInterface = (*MPC)(nil) - // At the moment the MPC use case configures itself as a 3-phase meter by default (ABC). -func NewMPC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback) *MPC { +func NewMPC( + localEntity spineapi.EntityLocalInterface, + eventCB api.EntityEventCallback, +) *MPC { validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeMonitoringAppliance} useCaseScenarios := []api.UseCaseScenario{ { @@ -350,37 +350,6 @@ func (e *MPC) AddFeatures() { if idP7 == nil { panic("error adding parameter description") } - - for _, id := range []*model.MeasurementIdType{ - e.acPowerTotal, - e.acPower[0], e.acPower[1], e.acPower[2], - e.acEnergyConsumed, - e.acEnergyProduced, - e.acCurrent[0], e.acCurrent[1], e.acCurrent[2], - e.acVoltage[0], e.acVoltage[1], e.acVoltage[2], - e.acFrequency} { - if err := e.setMeasurementDataForId(id, 0); err != nil { - panic(err) - } - } -} - -func (e *MPC) setMeasurementDataForId(id *model.MeasurementIdType, measurementData float64) error { - measurements, err := server.NewMeasurement(e.LocalEntity) - if err != nil { - return err - } - - err = measurements.UpdateDataForId(model.MeasurementDataType{ - MeasurementId: id, - ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), - Timestamp: model.NewAbsoluteOrRelativeTimeTypeFromTime(time.Now()), - Value: model.NewScaledNumberType(measurementData), - ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueState: util.Ptr(model.MeasurementValueStateTypeNormal), - }, nil, *id) - - return err } func (e *MPC) getMeasurementDataForId(id *model.MeasurementIdType) (float64, error) { @@ -400,3 +369,13 @@ func (e *MPC) getMeasurementDataForId(id *model.MeasurementIdType) (float64, err return data.Value.GetValue(), nil } + +func measuredValue(value float64) model.MeasurementDataType { + return model.MeasurementDataType{ + ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), + Timestamp: model.NewAbsoluteOrRelativeTimeTypeFromTime(time.Now()), + Value: model.NewScaledNumberType(value), + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueState: util.Ptr(model.MeasurementValueStateTypeNormal), + } +} From 05aa9f4449a104ac22ba6f2c6b0bb5090789d70f Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Tue, 15 Oct 2024 11:52:57 +0200 Subject: [PATCH 04/61] Make the mpc configurable. And support option stuff. --- usecases/api/mu_mpc.go | 199 ++++++++++ usecases/mu/mpc/config.go | 95 +++++ usecases/mu/mpc/public.go | 533 +++++++++++++++++-------- usecases/mu/mpc/public_test.go | 37 +- usecases/mu/mpc/testhelper_test.go | 39 +- usecases/mu/mpc/usecase.go | 601 +++++++++++++++++++---------- 6 files changed, 1126 insertions(+), 378 deletions(-) create mode 100644 usecases/api/mu_mpc.go create mode 100644 usecases/mu/mpc/config.go diff --git a/usecases/api/mu_mpc.go b/usecases/api/mu_mpc.go new file mode 100644 index 00000000..a4ba093f --- /dev/null +++ b/usecases/api/mu_mpc.go @@ -0,0 +1,199 @@ +package api + +import ( + "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/model" + "time" +) + +// Actor: Monitoring Unit +// UseCase: Monitoring of Power Consumption +type MuMPCInterface interface { + // ------------------------- Getters ------------------------- // + + // Scenario 1 + + // get the momentary active power consumption or production + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + Power() (float64, error) + + // get the momentary active power consumption or production per phase + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + PowerPerPhase() ([]float64, error) + + // Scenario 2 + + // get the total feed in energy + // + // - negative values are used for production + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + EnergyProduced() (float64, error) + + // get the total feed in energy + // + // - negative values are used for production + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + EnergyConsumed() (float64, error) + + // Scenario 3 + + // get the momentary phase specific current consumption or production + // + // - positive values are used for consumption + // - negative values are used for production + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + CurrentPerPhase() ([]float64, error) + + // Scenario 4 + + // get the phase specific voltage details + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + VoltagePerPhase() ([]float64, error) + + // Scenario 5 + + // get frequency + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + Frequency() (float64, error) + + // ------------------------- Setters ------------------------- // + + // use Update to update the measurement data + // use it like this: + // + // mpc.Update( + // mpc.UpdateDataPowerTotal(1000, nil, nil), + // mpc.UpdateDataPowerPhaseA(500, nil, nil), + // ... + // ) + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + Update(data ...api.MeasurementDataForID) error + + // Scenario 1 + + // use UpdateDataPowerTotal in Update to set the momentary active power consumption or production + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // use UpdateDataPowerPhaseA in Update to set the momentary active power consumption or production per phase + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // use UpdateDataPowerPhaseB in Update to set the momentary active power consumption or production per phase + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // use UpdateDataPowerPhaseC in Update to set the momentary active power consumption or production per phase + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // Scenario 2 + + // use UpdateDataEnergyConsumed in Update to set the total feed in energy + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + // The evaluationStart and End are optional and can be nil (both must be set to be used) + UpdateDataEnergyConsumed( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + evaluationStart *time.Time, + evaluationEnd *time.Time, + ) api.MeasurementDataForID + + // use UpdateDataEnergyProduced in Update to set the total feed in energy + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + // The evaluationStart and End are optional and can be nil (both must be set to be used) + UpdateDataEnergyProduced( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + evaluationStart *time.Time, + evaluationEnd *time.Time, + ) api.MeasurementDataForID + + // Scenario 3 + + // use UpdateDataCurrentPhaseA in Update to set the momentary phase specific current consumption or production + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // use UpdateDataCurrentPhaseB in Update to set the momentary phase specific current consumption or production + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // use UpdateDataCurrentPhaseC in Update to set the momentary phase specific current consumption or production + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // Scenario 4 + + // use UpdateDataVoltagePhaseA in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // use UpdateDataVoltagePhaseB in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // use UpdateDataVoltagePhaseC in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // use UpdateDataVoltagePhaseAToB in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // use UpdateDataVoltagePhaseBToC in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // use UpdateDataVoltagePhaseCToA in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + + // Scenario 5 + + // use AcFrequency in Update to set the frequency + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID +} diff --git a/usecases/mu/mpc/config.go b/usecases/mu/mpc/config.go new file mode 100644 index 00000000..c892af91 --- /dev/null +++ b/usecases/mu/mpc/config.go @@ -0,0 +1,95 @@ +package mpc + +import ( + "github.com/enbility/spine-go/model" + "strings" +) + +type ConnectedPhases string + +const ConnectedPhasesA ConnectedPhases = "a" +const ConnectedPhasesB ConnectedPhases = "b" +const ConnectedPhasesC ConnectedPhases = "c" +const ConnectedPhasesAB ConnectedPhases = "ab" +const ConnectedPhasesBC ConnectedPhases = "bc" +const ConnectedPhasesCA ConnectedPhases = "ac" +const ConnectedPhasesABC ConnectedPhases = "abc" + +// MonitorPowerConfig is the configuration for the monitor use case +// This config is required by the mpc use case and must be used in mpc.NewMPC +type MonitorPowerConfig struct { + ConnectedPhases ConnectedPhases // The phases that are measured + + ValueSourceTotal *model.MeasurementValueSourceType // The source of the values from the acPowerTotal (not optional) + ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values from the acPower for phase A (shall be set if the phase is supported) + ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values from the acPower for phase B (shall be set if the phase is supported) + ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values from the acPower for phase C (shall be set if the phase is supported) + + ValueConstraintsTotal *model.MeasurementConstraintsDataType // The constraints for the acPowerTotal (optional can be nil) + ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the acPower for phase A (optional can be nil) + ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the acPower for phase B (optional can be nil) + ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the acPower for phase C (optional can be nil) +} + +// MonitorEnergyConfig is the configuration for the monitor use case +// If this config is passed via NewMPC, the use case will support energy monitoring as specified +type MonitorEnergyConfig struct { + ValueSourceProduction *model.MeasurementValueSourceType // The source of the production values (if this is set, the use case will support production) (optional can be nil) + ValueConstraintsProduction *model.MeasurementConstraintsDataType // The constraints for the production values (optional can be nil) (needs ProductionValueSource to be set) + + ValueSourceConsumption *model.MeasurementValueSourceType // The source of the consumption values (if this is set, the use case will support consumption) (optional can be nil) + ValueConstraintsConsumption *model.MeasurementConstraintsDataType // The constraints for the consumption values (optional can be nil) (needs ConsumptionValueSource to be set) +} + +// MonitorCurrentConfig is the configuration for the monitor use case +// If this config is passed via NewMPC, the use case will support current monitoring +// The current phases will be the same as specified in MonitorPowerConfig +type MonitorCurrentConfig struct { + ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values for phase A (shall be set if the phase is supported) + ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values for phase B (shall be set if the phase is supported) + ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values for phase C (shall be set if the phase is supported) + + ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the current for phase A (optional can be nil) (needs ValueSourcePhaseA to be set) + ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the current for phase B (optional can be nil) (needs ValueSourcePhaseB to be set) + ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the current for phase C (optional can be nil) (needs ValueSourcePhaseC to be set) +} + +// MonitorVoltageConfig is the configuration for the monitor use case +// If this config is passed via NewMPC, the use case will support voltage monitoring +// The voltage phases will be the same as specified in MonitorPowerConfig +type MonitorVoltageConfig struct { + ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values for phase A (shall be set if the phase is supported) + ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values for phase B (shall be set if the phase is supported) + ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values for phase C (shall be set if the phase is supported) + + ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the voltage for phase A (optional can be nil) (needs ValueSourcePhaseA to be set) + ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the voltage for phase B (optional can be nil) (needs ValueSourcePhaseB to be set) + ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the voltage for phase C (optional can be nil) (needs ValueSourcePhaseC to be set) + + SupportPhaseToPhase bool // If the use case shall support phase to phase voltage monitoring + ValueSourcePhaseAToB *model.MeasurementValueSourceType // The source of the values for phase A to B (shall be set if the phases are supported and SupportPhaseToPhase is true) + ValueSourcePhaseBToC *model.MeasurementValueSourceType // The source of the values for phase B to C (shall be set if the phases are supported and SupportPhaseToPhase is true) + ValueSourcePhaseCToA *model.MeasurementValueSourceType // The source of the values for phase C to A (shall be set if the phases are supported and SupportPhaseToPhase is true) + + ValueConstraintsPhaseAToB *model.MeasurementConstraintsDataType // The constraints for the voltage for phase A to B (optional can be nil) (needs ValueSourcePhaseAToB to be set) + ValueConstraintsPhaseBToC *model.MeasurementConstraintsDataType // The constraints for the voltage for phase B to C (optional can be nil) (needs ValueSourcePhaseBToC to be set) + ValueConstraintsPhaseCToA *model.MeasurementConstraintsDataType // The constraints for the voltage for phase C to A (optional can be nil) (needs ValueSourcePhaseCToA to be set) +} + +// MonitorFrequencyConfig is the configuration for the monitor use case +type MonitorFrequencyConfig struct { + ValueSource *model.MeasurementValueSourceType // The source of the values (not optional) + ValueConstraints *model.MeasurementConstraintsDataType // The constraints for the frequency values (optional can be nil) +} + +func (c *MonitorPowerConfig) SupportsPhases(phase []string) bool { + phasesString := string(c.ConnectedPhases) + supports := true + for _, p := range phase { + if !strings.Contains(phasesString, p) { + supports = false + break + } + } + return supports +} diff --git a/usecases/mu/mpc/public.go b/usecases/mu/mpc/public.go index a19b857a..b3302a7d 100644 --- a/usecases/mu/mpc/public.go +++ b/usecases/mu/mpc/public.go @@ -3,6 +3,8 @@ package mpc import ( "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" + "github.com/enbility/spine-go/model" + "time" ) // ------------------------- Getters ------------------------- // @@ -28,26 +30,19 @@ func (e *MPC) Power() (float64, error) { // - ErrMissingData if the id is not available // - and others func (e *MPC) PowerPerPhase() ([]float64, error) { - if e.acPower[0] == nil || e.acPower[1] == nil || e.acPower[2] == nil { - return nil, api.ErrMissingData - } - - phaseA, err := e.getMeasurementDataForId(e.acPower[0]) - if err != nil { - return nil, err - } - - phaseB, err := e.getMeasurementDataForId(e.acPower[1]) - if err != nil { - return nil, err - } - - phaseC, err := e.getMeasurementDataForId(e.acPower[2]) - if err != nil { - return nil, err + powerPerPhase := make([]float64, 0) + + for _, id := range e.acPower { + if id != nil { + power, err := e.getMeasurementDataForId(id) + if err != nil { + return nil, err + } + powerPerPhase = append(powerPerPhase, power) + } } - return []float64{phaseA, phaseB, phaseC}, nil + return powerPerPhase, nil } // Scenario 2 @@ -93,26 +88,19 @@ func (e *MPC) EnergyProduced() (float64, error) { // - ErrMissingData if the id is not available // - and others func (e *MPC) CurrentPerPhase() ([]float64, error) { - if e.acCurrent[0] == nil || e.acCurrent[1] == nil || e.acCurrent[2] == nil { - return nil, api.ErrMissingData - } - - phaseA, err := e.getMeasurementDataForId(e.acCurrent[0]) - if err != nil { - return nil, err - } - - phaseB, err := e.getMeasurementDataForId(e.acCurrent[1]) - if err != nil { - return nil, err - } - - phaseC, err := e.getMeasurementDataForId(e.acCurrent[2]) - if err != nil { - return nil, err + currentPerPhase := make([]float64, 0) + + for _, id := range e.acCurrent { + if id != nil { + current, err := e.getMeasurementDataForId(id) + if err != nil { + return nil, err + } + currentPerPhase = append(currentPerPhase, current) + } } - return []float64{phaseA, phaseB, phaseC}, nil + return currentPerPhase, nil } // Scenario 4 @@ -123,43 +111,19 @@ func (e *MPC) CurrentPerPhase() ([]float64, error) { // - ErrMissingData if the id is not available // - and others func (e *MPC) VoltagePerPhase() ([]float64, error) { + voltagePerPhase := make([]float64, 0) + for _, id := range e.acVoltage { - if id == nil { - return nil, api.ErrMissingData + if id != nil { + voltage, err := e.getMeasurementDataForId(id) + if err != nil { + return nil, err + } + voltagePerPhase = append(voltagePerPhase, voltage) } } - phaseA, err := e.getMeasurementDataForId(e.acVoltage[0]) - if err != nil { - return nil, err - } - - phaseB, err := e.getMeasurementDataForId(e.acVoltage[1]) - if err != nil { - return nil, err - } - - phaseC, err := e.getMeasurementDataForId(e.acVoltage[2]) - if err != nil { - return nil, err - } - - phaseAToB, err := e.getMeasurementDataForId(e.acVoltage[3]) - if err != nil { - return nil, err - } - - phaseBToC, err := e.getMeasurementDataForId(e.acVoltage[4]) - if err != nil { - return nil, err - } - - phaseCToA, err := e.getMeasurementDataForId(e.acVoltage[5]) - if err != nil { - return nil, err - } - - return []float64{phaseA, phaseB, phaseC, phaseAToB, phaseBToC, phaseCToA}, nil + return voltagePerPhase, nil } // Scenario 5 @@ -179,163 +143,420 @@ func (e *MPC) Frequency() (float64, error) { // ------------------------- Setters ------------------------- // +// use MPC.Update to update the measurement data +// use it like this: +// +// mpc.Update( +// mpc.UpdateDataPowerTotal(1000, nil, nil), +// mpc.UpdateDataPowerPhaseA(500, nil, nil), +// ... +// ) +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (e *MPC) Update(measurementDataForIds ...api.MeasurementDataForID) error { + measurements, err := server.NewMeasurement(e.LocalEntity) + if err != nil { + return err + } + + return measurements.UpdateDataForIds(measurementDataForIds) +} + // Scenario 1 -// use MPC.MeasuredAcPowerTotal in MPC.Update to set the momentary active power consumption or production -func (e *MPC) MeasuredAcPowerTotal(acPowerTotal float64) api.MeasurementDataForID { +// use MPC.UpdateDataPowerTotal in MPC.Update to set the momentary active power consumption or production +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataPowerTotal( + acPowerTotal float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { return api.MeasurementDataForID{ - Data: measuredValue(acPowerTotal), - Id: *e.acPowerTotal, + Data: measurementData( + acPowerTotal, + timestamp, + e.powerConfig.ValueSourceTotal, + valueState, + nil, + nil, + ), + Id: *e.acPowerTotal, } } -// use MPC.MeasuredAcPowerPhaseA in MPC.Update to set the momentary active power consumption or production per phase -func (e *MPC) MeasuredAcPowerPhaseA(acPowerPhaseA float64) api.MeasurementDataForID { +// use MPC.UpdateDataPowerPhaseA in MPC.Update to set the momentary active power consumption or production per phase +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataPowerPhaseA( + acPowerPhaseA float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acPower[0] == nil { + panic("acPowerPhaseA is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(acPowerPhaseA), - Id: *e.acPower[0], + Data: measurementData( + acPowerPhaseA, + timestamp, + e.powerConfig.ValueSourcePhaseA, + valueState, + nil, + nil, + ), + Id: *e.acPower[0], } } -// use MPC.MeasuredAcPowerPhaseB in MPC.Update to set the momentary active power consumption or production per phase -func (e *MPC) MeasuredAcPowerPhaseB(acPowerPhaseB float64) api.MeasurementDataForID { +// use MPC.UpdateDataPowerPhaseB in MPC.Update to set the momentary active power consumption or production per phase +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataPowerPhaseB( + acPowerPhaseB float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acPower[1] == nil { + panic("acPowerPhaseB is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(acPowerPhaseB), - Id: *e.acPower[1], + Data: measurementData( + acPowerPhaseB, + timestamp, + e.powerConfig.ValueSourcePhaseB, + valueState, + nil, + nil, + ), + Id: *e.acPower[1], } } -// use MPC.MeasuredAcPowerPhaseC in MPC.Update to set the momentary active power consumption or production per phase -func (e *MPC) MeasuredAcPowerPhaseC(acPowerPhaseC float64) api.MeasurementDataForID { +// use MPC.UpdateDataPowerPhaseC in MPC.Update to set the momentary active power consumption or production per phase +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataPowerPhaseC( + acPowerPhaseC float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acPower[2] == nil { + panic("acPowerPhaseC is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(acPowerPhaseC), - Id: *e.acPower[2], + Data: measurementData( + acPowerPhaseC, + timestamp, + e.powerConfig.ValueSourcePhaseC, + valueState, + nil, + nil, + ), + Id: *e.acPower[2], } } // Scenario 2 -// use MPC.MeasuredAcEnergyConsumed in MPC.Update to set the total feed in energy -func (e *MPC) MeasuredAcEnergyConsumed(energyConsumed float64) api.MeasurementDataForID { +// use MPC.UpdateDataEnergyConsumed in MPC.Update to set the total feed in energy +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +// The evaluationStart and End are optional and can be nil (both must be set to be used) +func (e *MPC) UpdateDataEnergyConsumed( + energyConsumed float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + evaluationStart *time.Time, + evaluationEnd *time.Time, +) api.MeasurementDataForID { + if e.acEnergyConsumed == nil { + panic("acEnergyConsumed is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(energyConsumed), - Id: *e.acEnergyConsumed, + Data: measurementData( + energyConsumed, + timestamp, + e.energyConfig.ValueSourceConsumption, + valueState, + evaluationStart, + evaluationEnd, + ), + Id: *e.acEnergyConsumed, } } -// use MPC.MeasuredAcEnergyProduced in MPC.Update to set the total feed in energy -func (e *MPC) MeasuredAcEnergyProduced(energyProduced float64) api.MeasurementDataForID { +// use MPC.MeasuredUpdateDataEnergyProduced in MPC.Update to set the total feed in energy +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +// The evaluationStart and End are optional and can be nil (both must be set to be used) +func (e *MPC) UpdateDataEnergyProduced( + energyProduced float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + evaluationStart *time.Time, + evaluationEnd *time.Time, +) api.MeasurementDataForID { + if e.acEnergyProduced == nil { + panic("acEnergyProduced is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(energyProduced), - Id: *e.acEnergyProduced, + Data: measurementData( + energyProduced, + timestamp, + e.energyConfig.ValueSourceProduction, + valueState, + evaluationStart, + evaluationEnd, + ), + Id: *e.acEnergyProduced, } } // Scenario 3 -// use MPC.MeasuredAcCurrentPhaseA in MPC.Update to set the momentary phase specific current consumption or production -func (e *MPC) MeasuredAcCurrentPhaseA(acCurrentPhaseA float64) api.MeasurementDataForID { +// use MPC.UpdateDataCurrentPhaseA in MPC.Update to set the momentary phase specific current consumption or production +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataCurrentPhaseA( + acCurrentPhaseA float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acCurrent[0] == nil { + panic("acCurrentPhaseA is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(acCurrentPhaseA), - Id: *e.acCurrent[0], + Data: measurementData( + acCurrentPhaseA, + timestamp, + e.currentConfig.ValueSourcePhaseA, + valueState, + nil, + nil, + ), + Id: *e.acCurrent[0], } } -// use MPC.MeasuredAcCurrentPhaseB in MPC.Update to set the momentary phase specific current consumption or production -func (e *MPC) MeasuredAcCurrentPhaseB(acCurrentPhaseB float64) api.MeasurementDataForID { +// use MPC.UpdateDataCurrentPhaseB in MPC.Update to set the momentary phase specific current consumption or production +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataCurrentPhaseB( + acCurrentPhaseB float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acCurrent[1] == nil { + panic("acCurrentPhaseB is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(acCurrentPhaseB), - Id: *e.acCurrent[1], + Data: measurementData( + acCurrentPhaseB, + timestamp, + e.currentConfig.ValueSourcePhaseB, + valueState, + nil, + nil, + ), + Id: *e.acCurrent[1], } } -// use MPC.MeasuredAcCurrentPhaseC in MPC.Update to set the momentary phase specific current consumption or production -func (e *MPC) MeasuredAcCurrentPhaseC(acCurrentPhaseC float64) api.MeasurementDataForID { +// use MPC.UpdateDataCurrentPhaseC in MPC.Update to set the momentary phase specific current consumption or production +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataCurrentPhaseC( + acCurrentPhaseC float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acCurrent[2] == nil { + panic("acCurrentPhaseC is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(acCurrentPhaseC), - Id: *e.acCurrent[2], + Data: measurementData( + acCurrentPhaseC, + timestamp, + e.currentConfig.ValueSourcePhaseC, + valueState, + nil, + nil, + ), + Id: *e.acCurrent[2], } } // Scenario 4 -// use MPC.MeasuredAcVoltagePhaseA in MPC.Update to set the phase specific voltage details -func (e *MPC) MeasuredAcVoltagePhaseA(voltagePhaseA float64) api.MeasurementDataForID { +// use MPC.UpdateDataVoltagePhaseA in MPC.Update to set the phase specific voltage details +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataVoltagePhaseA( + voltagePhaseA float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acVoltage[0] == nil { + panic("acVoltagePhaseA is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(voltagePhaseA), - Id: *e.acVoltage[0], + Data: measurementData( + voltagePhaseA, + timestamp, + e.voltageConfig.ValueSourcePhaseA, + valueState, + nil, + nil, + ), + Id: *e.acVoltage[0], } } -// use MPC.MeasuredAcVoltagePhaseB in MPC.Update to set the phase specific voltage details -func (e *MPC) MeasuredAcVoltagePhaseB(voltagePhaseB float64) api.MeasurementDataForID { +// use MPC.UpdateDataVoltagePhaseB in MPC.Update to set the phase specific voltage details +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataVoltagePhaseB( + voltagePhaseB float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acVoltage[1] == nil { + panic("acVoltagePhaseB is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(voltagePhaseB), - Id: *e.acVoltage[1], + Data: measurementData( + voltagePhaseB, + timestamp, + e.voltageConfig.ValueSourcePhaseB, + valueState, + nil, + nil, + ), + Id: *e.acVoltage[1], } } -// use MPC.MeasuredAcVoltagePhaseC in MPC.Update to set the phase specific voltage details -func (e *MPC) MeasuredAcVoltagePhaseC(voltagePhaseC float64) api.MeasurementDataForID { +// use MPC.UpdateDataVoltagePhaseC in MPC.Update to set the phase specific voltage details +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataVoltagePhaseC( + voltagePhaseC float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acVoltage[2] == nil { + panic("acVoltagePhaseC is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(voltagePhaseC), - Id: *e.acVoltage[2], + Data: measurementData( + voltagePhaseC, + timestamp, + e.voltageConfig.ValueSourcePhaseC, + valueState, + nil, + nil, + ), + Id: *e.acVoltage[2], } } -// use MPC.MeasuredAcVoltagePhaseAToB in MPC.Update to set the phase specific voltage details -func (e *MPC) MeasuredAcVoltagePhaseAToB(voltagePhaseAToB float64) api.MeasurementDataForID { +// use MPC.UpdateDataVoltagePhaseAToB in MPC.Update to set the phase specific voltage details +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataVoltagePhaseAToB( + voltagePhaseAToB float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acVoltage[3] == nil { + panic("acVoltagePhaseAToB is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(voltagePhaseAToB), - Id: *e.acVoltage[3], + Data: measurementData( + voltagePhaseAToB, + timestamp, + e.voltageConfig.ValueSourcePhaseAToB, + valueState, + nil, + nil, + ), + Id: *e.acVoltage[3], } } -// use MPC.MeasuredAcVoltagePhaseBToC in MPC.Update to set the phase specific voltage details -func (e *MPC) MeasuredAcVoltagePhaseBToC(voltagePhaseBToC float64) api.MeasurementDataForID { +// use MPC.UpdateDataVoltagePhaseBToC in MPC.Update to set the phase specific voltage details +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataVoltagePhaseBToC( + voltagePhaseBToC float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acVoltage[4] == nil { + panic("acVoltagePhaseBToC is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(voltagePhaseBToC), - Id: *e.acVoltage[4], + Data: measurementData( + voltagePhaseBToC, + timestamp, + e.voltageConfig.ValueSourcePhaseBToC, + valueState, + nil, + nil, + ), + Id: *e.acVoltage[4], } } -// use MPC.MeasuredAcVoltagePhaseCToA in MPC.Update to set the phase specific voltage details -func (e *MPC) MeasuredAcVoltagePhaseCToA(voltagePhaseCToA float64) api.MeasurementDataForID { +// use MPC.UpdateDataVoltagePhaseCToA in MPC.Update to set the phase specific voltage details +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataVoltagePhaseCToA( + voltagePhaseCToA float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acVoltage[5] == nil { + panic("acVoltagePhaseCToA is not supported, please check the configuration") + } return api.MeasurementDataForID{ - Data: measuredValue(voltagePhaseCToA), - Id: *e.acVoltage[5], + Data: measurementData( + voltagePhaseCToA, + timestamp, + e.voltageConfig.ValueSourcePhaseCToA, + valueState, + nil, + nil, + ), + Id: *e.acVoltage[5], } } // Scenario 5 -// use MPC.MeasuredAcFrequency in MPC.Update to set the frequency -func (e *MPC) MeasuredAcFrequency(frequency float64) api.MeasurementDataForID { - return api.MeasurementDataForID{ - Data: measuredValue(frequency), - Id: *e.acFrequency, +// use MPC.UpdateDataFrequency in MPC.Update to set the frequency +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (e *MPC) UpdateDataFrequency( + frequency float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) api.MeasurementDataForID { + if e.acFrequency == nil { + panic("acFrequency is not supported, please check the configuration") } -} - -// Update the measurement data - -// use MPC.Update to update the measurement data -// use it like this: -// -// mpc.Update( -// mpc.MeasuredAcPowerTotal(1000), -// mpc.MeasuredAcPowerPhaseA(500), -// ... -// ) -// -// possible errors: -// - ErrMissingData if the id is not available -// - and others -func (e *MPC) Update(measurementDataForIds ...api.MeasurementDataForID) error { - measurements, err := server.NewMeasurement(e.LocalEntity) - if err != nil { - return err + return api.MeasurementDataForID{ + Data: measurementData( + frequency, + timestamp, + e.frequencyConfig.ValueSource, + valueState, + nil, + nil, + ), + Id: *e.acFrequency, } - - return measurements.UpdateDataForIds(measurementDataForIds) } diff --git a/usecases/mu/mpc/public_test.go b/usecases/mu/mpc/public_test.go index a09a2fa6..bea94e79 100644 --- a/usecases/mu/mpc/public_test.go +++ b/usecases/mu/mpc/public_test.go @@ -1,12 +1,15 @@ package mpc import ( + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" "github.com/stretchr/testify/assert" + "time" ) func (s *MuMPCSuite) Test_Power() { err := s.sut.Update( - s.sut.MeasuredAcPowerTotal(5.0), + s.sut.UpdateDataPowerTotal(5.0, util.Ptr(time.Now()), nil), ) assert.Nil(s.T(), err) @@ -17,9 +20,9 @@ func (s *MuMPCSuite) Test_Power() { func (s *MuMPCSuite) Test_PowerPerPhase() { err := s.sut.Update( - s.sut.MeasuredAcPowerPhaseA(5.0), - s.sut.MeasuredAcPowerPhaseB(6.0), - s.sut.MeasuredAcPowerPhaseC(7.0), + s.sut.UpdateDataPowerPhaseA(5.0, util.Ptr(time.Now()), nil), + s.sut.UpdateDataPowerPhaseB(6.0, util.Ptr(time.Now()), nil), + s.sut.UpdateDataPowerPhaseC(7.0, util.Ptr(time.Now()), util.Ptr(model.MeasurementValueStateTypeError)), ) assert.Nil(s.T(), err) @@ -30,7 +33,7 @@ func (s *MuMPCSuite) Test_PowerPerPhase() { func (s *MuMPCSuite) Test_EnergyConsumed() { err := s.sut.Update( - s.sut.MeasuredAcEnergyConsumed(5.0), + s.sut.UpdateDataEnergyConsumed(5.0, util.Ptr(time.Now()), nil, util.Ptr(time.Now()), util.Ptr(time.Now())), ) assert.Nil(s.T(), err) @@ -41,7 +44,7 @@ func (s *MuMPCSuite) Test_EnergyConsumed() { func (s *MuMPCSuite) Test_EnergyProduced() { err := s.sut.Update( - s.sut.MeasuredAcEnergyProduced(5.0), + s.sut.UpdateDataEnergyProduced(5.0, nil, nil, nil, nil), ) assert.Nil(s.T(), err) @@ -52,25 +55,25 @@ func (s *MuMPCSuite) Test_EnergyProduced() { func (s *MuMPCSuite) Test_CurrentPerPhase() { err := s.sut.Update( - s.sut.MeasuredAcCurrentPhaseA(5.0), - s.sut.MeasuredAcCurrentPhaseB(5.0), - s.sut.MeasuredAcCurrentPhaseC(5.0), + s.sut.UpdateDataCurrentPhaseA(5.0, nil, nil), + s.sut.UpdateDataCurrentPhaseB(3.0, nil, nil), + s.sut.UpdateDataCurrentPhaseC(1.0, nil, nil), ) assert.Nil(s.T(), err) currentPerPhases, err := s.sut.CurrentPerPhase() assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.0, 5.0, 5.0}, currentPerPhases) + assert.Equal(s.T(), []float64{5.0, 3.0, 1.0}, currentPerPhases) } func (s *MuMPCSuite) Test_VoltagePerPhase() { err := s.sut.Update( - s.sut.MeasuredAcVoltagePhaseA(5.0), - s.sut.MeasuredAcVoltagePhaseB(6.0), - s.sut.MeasuredAcVoltagePhaseC(7.0), - s.sut.MeasuredAcVoltagePhaseAToB(8.0), - s.sut.MeasuredAcVoltagePhaseBToC(9.0), - s.sut.MeasuredAcVoltagePhaseCToA(10.0), + s.sut.UpdateDataVoltagePhaseA(5.0, nil, nil), + s.sut.UpdateDataVoltagePhaseB(6.0, nil, nil), + s.sut.UpdateDataVoltagePhaseC(7.0, nil, nil), + s.sut.UpdateDataVoltagePhaseAToB(8.0, nil, nil), + s.sut.UpdateDataVoltagePhaseBToC(9.0, nil, nil), + s.sut.UpdateDataVoltagePhaseCToA(10.0, nil, nil), ) assert.Nil(s.T(), err) @@ -81,7 +84,7 @@ func (s *MuMPCSuite) Test_VoltagePerPhase() { func (s *MuMPCSuite) Test_Frequency() { err := s.sut.Update( - s.sut.MeasuredAcFrequency(5.0), + s.sut.UpdateDataFrequency(5.0, nil, nil), ) assert.Nil(s.T(), err) diff --git a/usecases/mu/mpc/testhelper_test.go b/usecases/mu/mpc/testhelper_test.go index e983480d..c4b4dde4 100644 --- a/usecases/mu/mpc/testhelper_test.go +++ b/usecases/mu/mpc/testhelper_test.go @@ -12,6 +12,7 @@ import ( spineapi "github.com/enbility/spine-go/api" spinemocks "github.com/enbility/spine-go/mocks" "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" ) @@ -73,7 +74,43 @@ func (s *MuMPCSuite) BeforeTest(suiteName, testName string) { mockRemoteFeature.EXPECT().Operations().Return(nil).Maybe() localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) - s.sut = NewMPC(localEntity, s.Event) + s.sut, _ = NewMPC( + localEntity, + s.Event, + &MonitorPowerConfig{ + ConnectedPhases: ConnectedPhasesABC, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorVoltageConfig{ + SupportPhaseToPhase: true, + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + }, + ) s.sut.AddFeatures() s.sut.AddUseCase() diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index 46dade50..8538a05f 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -1,6 +1,7 @@ package mpc import ( + "errors" "time" "github.com/enbility/eebus-go/api" @@ -15,6 +16,12 @@ import ( type MPC struct { *usecase.UseCaseBase + powerConfig *MonitorPowerConfig + energyConfig *MonitorEnergyConfig + currentConfig *MonitorCurrentConfig + voltageConfig *MonitorVoltageConfig + frequencyConfig *MonitorFrequencyConfig + acPowerTotal *model.MeasurementIdType acPower [3]*model.MeasurementIdType acEnergyConsumed *model.MeasurementIdType @@ -24,11 +31,19 @@ type MPC struct { acFrequency *model.MeasurementIdType } -// At the moment the MPC use case configures itself as a 3-phase meter by default (ABC). func NewMPC( localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback, -) *MPC { + monitorPowerConfig *MonitorPowerConfig, + monitorEnergyConfig *MonitorEnergyConfig, + monitorCurrentConfig *MonitorCurrentConfig, + monitorVoltageConfig *MonitorVoltageConfig, + monitorFrequencyConfig *MonitorFrequencyConfig, +) (*MPC, error) { + if monitorPowerConfig == nil { + return nil, errors.New("the monitor power config for the MPC-Use-Case must not be nil") + } + validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeMonitoringAppliance} useCaseScenarios := []api.UseCaseScenario{ { @@ -88,30 +103,46 @@ func NewMPC( ) uc := &MPC{ - UseCaseBase: u, + UseCaseBase: u, + powerConfig: monitorPowerConfig, + energyConfig: monitorEnergyConfig, + currentConfig: monitorCurrentConfig, + voltageConfig: monitorVoltageConfig, + frequencyConfig: monitorFrequencyConfig, } _ = spine.Events.Subscribe(uc) - return uc + return uc, nil } func (e *MPC) AddFeatures() { // server features - f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) - f.AddFunctionType(model.FunctionTypeElectricalConnectionDescriptionListData, true, false) - f.AddFunctionType(model.FunctionTypeElectricalConnectionParameterDescriptionListData, true, false) + electricalConnectionFeatrue := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) + electricalConnectionFeatrue.AddFunctionType(model.FunctionTypeElectricalConnectionDescriptionListData, true, false) + electricalConnectionFeatrue.AddFunctionType(model.FunctionTypeElectricalConnectionParameterDescriptionListData, true, false) - f = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) - f.AddFunctionType(model.FunctionTypeMeasurementDescriptionListData, true, false) - f.AddFunctionType(model.FunctionTypeMeasurementConstraintsListData, true, false) - f.AddFunctionType(model.FunctionTypeMeasurementListData, true, false) + measurementFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) + measurementFeature.AddFunctionType(model.FunctionTypeMeasurementDescriptionListData, true, false) + measurementFeature.AddFunctionType(model.FunctionTypeMeasurementConstraintsListData, true, false) + measurementFeature.AddFunctionType(model.FunctionTypeMeasurementListData, true, false) measurements, err := server.NewMeasurement(e.LocalEntity) if err != nil { panic(err) } + var phases = [][]string{ + {"a"}, + {"b"}, + {"c"}, + {"a", "b"}, + {"b", "c"}, + {"c", "a"}, + } + + var constraints = make([]model.MeasurementConstraintsDataType, 0) + e.acPowerTotal = measurements.AddDescription(model.MeasurementDescriptionDataType{ MeasurementType: util.Ptr(model.MeasurementTypeTypePower), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), @@ -119,54 +150,116 @@ func (e *MPC) AddFeatures() { ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), }) + if e.powerConfig.ValueConstraintsTotal != nil { + e.powerConfig.ValueConstraintsTotal.MeasurementId = e.acPowerTotal + constraints = append(constraints, *e.powerConfig.ValueConstraintsTotal) + } + + acPowerConstraints := []*model.MeasurementConstraintsDataType{ + e.powerConfig.ValueConstraintsPhaseA, + e.powerConfig.ValueConstraintsPhaseB, + e.powerConfig.ValueConstraintsPhaseC, + } for id := 0; id < len(e.acPower); id++ { - e.acPower[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + if e.powerConfig.SupportsPhases(phases[id]) { + e.acPower[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeW), + ScopeType: util.Ptr(model.ScopeTypeTypeACPower), + }) + if acPowerConstraints[id] != nil { + acPowerConstraints[id].MeasurementId = e.acPower[id] + constraints = append(constraints, *acPowerConstraints[id]) + } + } + } + + if e.energyConfig.ValueSourceConsumption != nil { + e.acEnergyConsumed = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeW), - ScopeType: util.Ptr(model.ScopeTypeTypeACPower), + Unit: util.Ptr(model.UnitOfMeasurementTypeWh), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), }) + if e.energyConfig.ValueConstraintsConsumption != nil { + e.energyConfig.ValueConstraintsConsumption.MeasurementId = e.acEnergyConsumed + constraints = append(constraints, *e.energyConfig.ValueConstraintsConsumption) + } } - e.acEnergyConsumed = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeWh), - ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), - }) - - e.acEnergyProduced = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeWh), - ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), - }) - - for id := 0; id < len(e.acCurrent); id++ { - e.acCurrent[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + if e.energyConfig.ValueSourceProduction != nil { + e.acEnergyProduced = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeA), - ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + Unit: util.Ptr(model.UnitOfMeasurementTypeWh), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), }) + if e.energyConfig.ValueConstraintsProduction != nil { + e.energyConfig.ValueConstraintsProduction.MeasurementId = e.acEnergyProduced + constraints = append(constraints, *e.energyConfig.ValueConstraintsProduction) + } } + acCurrentConstraints := []*model.MeasurementConstraintsDataType{ + e.currentConfig.ValueConstraintsPhaseA, + e.currentConfig.ValueConstraintsPhaseB, + e.currentConfig.ValueConstraintsPhaseC, + } + for id := 0; id < len(e.acCurrent); id++ { + if e.powerConfig.SupportsPhases(phases[id]) { + e.acCurrent[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeA), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + }) + if acCurrentConstraints[id] != nil { + acCurrentConstraints[id].MeasurementId = e.acCurrent[id] + constraints = append(constraints, *acCurrentConstraints[id]) + } + } + } + + acVoltageConstraints := []*model.MeasurementConstraintsDataType{ + e.voltageConfig.ValueConstraintsPhaseA, + e.voltageConfig.ValueConstraintsPhaseB, + e.voltageConfig.ValueConstraintsPhaseC, + e.voltageConfig.ValueConstraintsPhaseAToB, + e.voltageConfig.ValueConstraintsPhaseBToC, + e.voltageConfig.ValueConstraintsPhaseCToA, + } for id := 0; id < len(e.acVoltage); id++ { - e.acVoltage[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + if e.powerConfig.SupportsPhases(phases[id]) { + if len(phases[id]) == 2 && !e.voltageConfig.SupportPhaseToPhase { + continue + } + e.acVoltage[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + if acVoltageConstraints[id] != nil { + acVoltageConstraints[id].MeasurementId = e.acVoltage[id] + constraints = append(constraints, *acVoltageConstraints[id]) + } + } + } + + if e.frequencyConfig != nil { + e.acFrequency = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeV), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + Unit: util.Ptr(model.UnitOfMeasurementTypeHz), + ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), }) + if e.frequencyConfig.ValueConstraints != nil { + e.frequencyConfig.ValueConstraints.MeasurementId = e.acFrequency + constraints = append(constraints, *e.frequencyConfig.ValueConstraints) + } } - e.acFrequency = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeHz), - ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), - }) - electricalConnection, err := server.NewElectricalConnection(e.LocalEntity) if err != nil { panic(err) @@ -186,7 +279,7 @@ func (e *MPC) AddFeatures() { ElectricalConnectionId: util.Ptr(idEc1), MeasurementId: e.acPowerTotal, VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeAbc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameType(e.powerConfig.ConnectedPhases)), AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), @@ -196,159 +289,240 @@ func (e *MPC) AddFeatures() { panic("error adding parameter description") } - p21 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acPower[0], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP21 := electricalConnection.AddParameterDescription(p21) - if idP21 == nil { - panic("error adding parameter description") - } - - p22 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acPower[1], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP22 := electricalConnection.AddParameterDescription(p22) - if idP22 == nil { - panic("error adding parameter description") - } - - p23 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acPower[2], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP23 := electricalConnection.AddParameterDescription(p23) - if idP23 == nil { - panic("error adding parameter description") - } - - p3 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acEnergyConsumed, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - } - idP3 := electricalConnection.AddParameterDescription(p3) - if idP3 == nil { - panic("error adding parameter description") - } - - p4 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acEnergyProduced, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - } - idP4 := electricalConnection.AddParameterDescription(p4) - if idP4 == nil { - panic("error adding parameter description") - } - - p51 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acCurrent[0], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP51 := electricalConnection.AddParameterDescription(p51) - if idP51 == nil { - panic("error adding parameter description") - } - - p52 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acCurrent[1], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP52 := electricalConnection.AddParameterDescription(p52) - if idP52 == nil { - panic("error adding parameter description") - } - - p53 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acCurrent[2], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP53 := electricalConnection.AddParameterDescription(p53) - if idP53 == nil { - panic("error adding parameter description") - } - - p61 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acVoltage[0], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP61 := electricalConnection.AddParameterDescription(p61) - if idP61 == nil { - panic("error adding parameter description") - } - - p62 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acVoltage[1], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP62 := electricalConnection.AddParameterDescription(p62) - if idP62 == nil { - panic("error adding parameter description") - } - - p63 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acVoltage[2], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP63 := electricalConnection.AddParameterDescription(p63) - if idP63 == nil { - panic("error adding parameter description") - } - - p7 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acFrequency, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - } - idP7 := electricalConnection.AddParameterDescription(p7) - if idP7 == nil { - panic("error adding parameter description") + if e.acPower[0] != nil { + p21 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acPower[0], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP21 := electricalConnection.AddParameterDescription(p21) + if idP21 == nil { + panic("error adding parameter description") + } + } + + if e.acPower[1] != nil { + p22 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acPower[1], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP22 := electricalConnection.AddParameterDescription(p22) + if idP22 == nil { + panic("error adding parameter description") + } + } + + if e.acPower[2] != nil { + p23 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acPower[2], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP23 := electricalConnection.AddParameterDescription(p23) + if idP23 == nil { + panic("error adding parameter description") + } + } + + if e.acEnergyConsumed != nil { + p3 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acEnergyConsumed, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + } + idP3 := electricalConnection.AddParameterDescription(p3) + if idP3 == nil { + panic("error adding parameter description") + } + } + + if e.acEnergyProduced != nil { + p4 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acEnergyProduced, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + } + idP4 := electricalConnection.AddParameterDescription(p4) + if idP4 == nil { + panic("error adding parameter description") + } + } + + if e.acCurrent[0] != nil { + p51 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acCurrent[0], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP51 := electricalConnection.AddParameterDescription(p51) + if idP51 == nil { + panic("error adding parameter description") + } + } + + if e.acCurrent[1] != nil { + p52 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acCurrent[1], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP52 := electricalConnection.AddParameterDescription(p52) + if idP52 == nil { + panic("error adding parameter description") + } + } + + if e.acCurrent[2] != nil { + p53 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acCurrent[2], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP53 := electricalConnection.AddParameterDescription(p53) + if idP53 == nil { + panic("error adding parameter description") + } + } + + if e.acVoltage[0] != nil { + p61 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acVoltage[0], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP61 := electricalConnection.AddParameterDescription(p61) + if idP61 == nil { + panic("error adding parameter description") + } + } + + if e.acVoltage[1] != nil { + p62 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acVoltage[1], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP62 := electricalConnection.AddParameterDescription(p62) + if idP62 == nil { + panic("error adding parameter description") + } + } + + if e.acVoltage[2] != nil { + p63 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acVoltage[2], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP63 := electricalConnection.AddParameterDescription(p63) + if idP63 == nil { + panic("error adding parameter description") + } + } + + if e.acVoltage[3] != nil { + p64 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acVoltage[3], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP64 := electricalConnection.AddParameterDescription(p64) + if idP64 == nil { + panic("error adding parameter description") + } + } + + if e.acVoltage[4] != nil { + p65 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acVoltage[4], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP65 := electricalConnection.AddParameterDescription(p65) + if idP65 == nil { + panic("error adding parameter description") + } + } + + if e.acVoltage[5] != nil { + p66 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acVoltage[5], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + idP66 := electricalConnection.AddParameterDescription(p66) + if idP66 == nil { + panic("error adding parameter description") + } + } + + if e.acFrequency != nil { + p7 := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.acFrequency, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + } + idP7 := electricalConnection.AddParameterDescription(p7) + if idP7 == nil { + panic("error adding parameter description") + } + } + + if len(constraints) > 0 { + measurementFeature.UpdateData( + model.FunctionTypeMeasurementConstraintsListData, + &model.MeasurementConstraintsListDataType{ + MeasurementConstraintsData: constraints, + }, nil, nil, + ) } } @@ -370,12 +544,31 @@ func (e *MPC) getMeasurementDataForId(id *model.MeasurementIdType) (float64, err return data.Value.GetValue(), nil } -func measuredValue(value float64) model.MeasurementDataType { - return model.MeasurementDataType{ +func measurementData( + value float64, + timestamp *time.Time, + valueSource *model.MeasurementValueSourceType, + valueState *model.MeasurementValueStateType, + evaluationStart *time.Time, + evaluationEnd *time.Time, +) model.MeasurementDataType { + measurement := model.MeasurementDataType{ ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), - Timestamp: model.NewAbsoluteOrRelativeTimeTypeFromTime(time.Now()), Value: model.NewScaledNumberType(value), - ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueState: util.Ptr(model.MeasurementValueStateTypeNormal), + ValueSource: valueSource, + ValueState: valueState, + } + + if timestamp != nil { + measurement.Timestamp = model.NewAbsoluteOrRelativeTimeTypeFromTime(*timestamp) } + + if evaluationStart != nil && evaluationEnd != nil { + measurement.EvaluationPeriod = &model.TimePeriodType{ + StartTime: model.NewAbsoluteOrRelativeTimeTypeFromTime(*evaluationStart), + EndTime: model.NewAbsoluteOrRelativeTimeTypeFromTime(*evaluationEnd), + } + } + + return measurement } From 2bdd1569b3bda6c9f27dfad3e1926d5fa1f476d8 Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Mon, 4 Nov 2024 09:10:22 +0100 Subject: [PATCH 05/61] Fix comments and formatting mentioned in review --- usecases/mu/mpc/config.go | 77 +++++++++++++++++++------------------ usecases/usecase/usecase.go | 1 - 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/usecases/mu/mpc/config.go b/usecases/mu/mpc/config.go index c892af91..52113791 100644 --- a/usecases/mu/mpc/config.go +++ b/usecases/mu/mpc/config.go @@ -1,29 +1,32 @@ package mpc import ( - "github.com/enbility/spine-go/model" "strings" + + "github.com/enbility/spine-go/model" ) type ConnectedPhases string -const ConnectedPhasesA ConnectedPhases = "a" -const ConnectedPhasesB ConnectedPhases = "b" -const ConnectedPhasesC ConnectedPhases = "c" -const ConnectedPhasesAB ConnectedPhases = "ab" -const ConnectedPhasesBC ConnectedPhases = "bc" -const ConnectedPhasesCA ConnectedPhases = "ac" -const ConnectedPhasesABC ConnectedPhases = "abc" +const ( + ConnectedPhasesA ConnectedPhases = "a" + ConnectedPhasesB ConnectedPhases = "b" + ConnectedPhasesC ConnectedPhases = "c" + ConnectedPhasesAB ConnectedPhases = "ab" + ConnectedPhasesBC ConnectedPhases = "bc" + ConnectedPhasesCA ConnectedPhases = "ac" + ConnectedPhasesABC ConnectedPhases = "abc" +) // MonitorPowerConfig is the configuration for the monitor use case // This config is required by the mpc use case and must be used in mpc.NewMPC type MonitorPowerConfig struct { ConnectedPhases ConnectedPhases // The phases that are measured - ValueSourceTotal *model.MeasurementValueSourceType // The source of the values from the acPowerTotal (not optional) - ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values from the acPower for phase A (shall be set if the phase is supported) - ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values from the acPower for phase B (shall be set if the phase is supported) - ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values from the acPower for phase C (shall be set if the phase is supported) + ValueSourceTotal *model.MeasurementValueSourceType // The source of the values from the acPowerTotal (required) + ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values from the acPower for phase A (required if the phase is supported) + ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values from the acPower for phase B (required if the phase is supported) + ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values from the acPower for phase C (required if the phase is supported) ValueConstraintsTotal *model.MeasurementConstraintsDataType // The constraints for the acPowerTotal (optional can be nil) ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the acPower for phase A (optional can be nil) @@ -35,50 +38,50 @@ type MonitorPowerConfig struct { // If this config is passed via NewMPC, the use case will support energy monitoring as specified type MonitorEnergyConfig struct { ValueSourceProduction *model.MeasurementValueSourceType // The source of the production values (if this is set, the use case will support production) (optional can be nil) - ValueConstraintsProduction *model.MeasurementConstraintsDataType // The constraints for the production values (optional can be nil) (needs ProductionValueSource to be set) + ValueConstraintsProduction *model.MeasurementConstraintsDataType // The constraints for the production values (optional can be nil) (requires ProductionValueSource to be set) ValueSourceConsumption *model.MeasurementValueSourceType // The source of the consumption values (if this is set, the use case will support consumption) (optional can be nil) - ValueConstraintsConsumption *model.MeasurementConstraintsDataType // The constraints for the consumption values (optional can be nil) (needs ConsumptionValueSource to be set) + ValueConstraintsConsumption *model.MeasurementConstraintsDataType // The constraints for the consumption values (optional can be nil) (requires ConsumptionValueSource to be set) } // MonitorCurrentConfig is the configuration for the monitor use case // If this config is passed via NewMPC, the use case will support current monitoring // The current phases will be the same as specified in MonitorPowerConfig type MonitorCurrentConfig struct { - ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values for phase A (shall be set if the phase is supported) - ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values for phase B (shall be set if the phase is supported) - ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values for phase C (shall be set if the phase is supported) + ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values for phase A (required if the phase is supported) + ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values for phase B (required if the phase is supported) + ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values for phase C (required if the phase is supported) - ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the current for phase A (optional can be nil) (needs ValueSourcePhaseA to be set) - ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the current for phase B (optional can be nil) (needs ValueSourcePhaseB to be set) - ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the current for phase C (optional can be nil) (needs ValueSourcePhaseC to be set) + ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the current for phase A (optional can be nil) (requires ValueSourcePhaseA to be set) + ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the current for phase B (optional can be nil) (requires ValueSourcePhaseB to be set) + ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the current for phase C (optional can be nil) (requires ValueSourcePhaseC to be set) } // MonitorVoltageConfig is the configuration for the monitor use case // If this config is passed via NewMPC, the use case will support voltage monitoring // The voltage phases will be the same as specified in MonitorPowerConfig type MonitorVoltageConfig struct { - ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values for phase A (shall be set if the phase is supported) - ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values for phase B (shall be set if the phase is supported) - ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values for phase C (shall be set if the phase is supported) - - ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the voltage for phase A (optional can be nil) (needs ValueSourcePhaseA to be set) - ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the voltage for phase B (optional can be nil) (needs ValueSourcePhaseB to be set) - ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the voltage for phase C (optional can be nil) (needs ValueSourcePhaseC to be set) - - SupportPhaseToPhase bool // If the use case shall support phase to phase voltage monitoring - ValueSourcePhaseAToB *model.MeasurementValueSourceType // The source of the values for phase A to B (shall be set if the phases are supported and SupportPhaseToPhase is true) - ValueSourcePhaseBToC *model.MeasurementValueSourceType // The source of the values for phase B to C (shall be set if the phases are supported and SupportPhaseToPhase is true) - ValueSourcePhaseCToA *model.MeasurementValueSourceType // The source of the values for phase C to A (shall be set if the phases are supported and SupportPhaseToPhase is true) - - ValueConstraintsPhaseAToB *model.MeasurementConstraintsDataType // The constraints for the voltage for phase A to B (optional can be nil) (needs ValueSourcePhaseAToB to be set) - ValueConstraintsPhaseBToC *model.MeasurementConstraintsDataType // The constraints for the voltage for phase B to C (optional can be nil) (needs ValueSourcePhaseBToC to be set) - ValueConstraintsPhaseCToA *model.MeasurementConstraintsDataType // The constraints for the voltage for phase C to A (optional can be nil) (needs ValueSourcePhaseCToA to be set) + ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values for phase A (required if the phase is supported) + ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values for phase B (required if the phase is supported) + ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values for phase C (required if the phase is supported) + + ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the voltage for phase A (optional can be nil) (requires ValueSourcePhaseA to be set) + ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the voltage for phase B (optional can be nil) (requires ValueSourcePhaseB to be set) + ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the voltage for phase C (optional can be nil) (requires ValueSourcePhaseC to be set) + + SupportPhaseToPhase bool // Set to true if the use case supports phase to phase voltage monitoring + ValueSourcePhaseAToB *model.MeasurementValueSourceType // The source of the values for phase A to B (required if the phases are supported and SupportPhaseToPhase is true) + ValueSourcePhaseBToC *model.MeasurementValueSourceType // The source of the values for phase B to C (required if the phases are supported and SupportPhaseToPhase is true) + ValueSourcePhaseCToA *model.MeasurementValueSourceType // The source of the values for phase C to A (required if the phases are supported and SupportPhaseToPhase is true) + + ValueConstraintsPhaseAToB *model.MeasurementConstraintsDataType // The constraints for the voltage for phase A to B (optional can be nil) (requires ValueSourcePhaseAToB to be set) + ValueConstraintsPhaseBToC *model.MeasurementConstraintsDataType // The constraints for the voltage for phase B to C (optional can be nil) (requires ValueSourcePhaseBToC to be set) + ValueConstraintsPhaseCToA *model.MeasurementConstraintsDataType // The constraints for the voltage for phase C to A (optional can be nil) (requires ValueSourcePhaseCToA to be set) } // MonitorFrequencyConfig is the configuration for the monitor use case type MonitorFrequencyConfig struct { - ValueSource *model.MeasurementValueSourceType // The source of the values (not optional) + ValueSource *model.MeasurementValueSourceType // The source of the values (required) ValueConstraints *model.MeasurementConstraintsDataType // The constraints for the frequency values (optional can be nil) } diff --git a/usecases/usecase/usecase.go b/usecases/usecase/usecase.go index 039b0ada..2cd425a1 100644 --- a/usecases/usecase/usecase.go +++ b/usecases/usecase/usecase.go @@ -113,7 +113,6 @@ func (u *UseCaseBase) UpdateUseCaseAvailability(available bool) { func (u *UseCaseBase) IsCompatibleEntityType(entity spineapi.EntityRemoteInterface) bool { if entity == nil { - return false } From 715e1b05baa3c18791a882da9b37426384301834 Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Mon, 4 Nov 2024 09:10:22 +0100 Subject: [PATCH 06/61] Only add scenarios when they're supported This commit also adds some fixes to allow leaving unsupported config parameters to NewMPC as nil and a test for those scenarios. --- usecases/mu/mpc/usecase.go | 165 +++++++++++++++++++------------- usecases/mu/mpc/usecase_test.go | 151 +++++++++++++++++++++++++++++ 2 files changed, 249 insertions(+), 67 deletions(-) create mode 100644 usecases/mu/mpc/usecase_test.go diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index 8538a05f..795c55ae 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -31,6 +31,19 @@ type MPC struct { acFrequency *model.MeasurementIdType } +// creates a new MPC usecase instance for a MonitoredUnit entity +// +// parameters: +// - localEntity: the local entity for which to construct an MPC instance +// - eventCB: the callback to notify about events for this usecase +// - monitorPowerConfig: (required) configuration parameters for MPC scenario 1 +// - monitorEnergyConfig: (optional) configuration parameters for MPC scenario 2, nil if not supported +// - monitorCurrentConfig: (optional) configuration parameters for MPC scenario 3, nil if not supported +// - monitorVoltageConfig: (optional) configuration parameters for MPC scenario 4, nil if not supported +// - monitorFrequencyConfig: (optional) configuration parameters for MPC scenario, nil if not supported +// +// possible errors: +// - if required fields in parameters are unset func NewMPC( localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback, @@ -54,38 +67,50 @@ func NewMPC( model.FeatureTypeTypeMeasurement, }, }, - { + } + + if monitorEnergyConfig != nil { + useCaseScenarios = append(useCaseScenarios, api.UseCaseScenario{ Scenario: model.UseCaseScenarioSupportType(2), Mandatory: false, ServerFeatures: []model.FeatureTypeType{ model.FeatureTypeTypeElectricalConnection, model.FeatureTypeTypeMeasurement, }, - }, - { + }) + } + + if monitorCurrentConfig != nil { + useCaseScenarios = append(useCaseScenarios, api.UseCaseScenario{ Scenario: model.UseCaseScenarioSupportType(3), Mandatory: false, ServerFeatures: []model.FeatureTypeType{ model.FeatureTypeTypeElectricalConnection, model.FeatureTypeTypeMeasurement, }, - }, - { + }) + } + + if monitorVoltageConfig != nil { + useCaseScenarios = append(useCaseScenarios, api.UseCaseScenario{ Scenario: model.UseCaseScenarioSupportType(4), Mandatory: false, ServerFeatures: []model.FeatureTypeType{ model.FeatureTypeTypeElectricalConnection, model.FeatureTypeTypeMeasurement, }, - }, - { + }) + } + + if monitorFrequencyConfig != nil { + useCaseScenarios = append(useCaseScenarios, api.UseCaseScenario{ Scenario: model.UseCaseScenarioSupportType(5), Mandatory: false, ServerFeatures: []model.FeatureTypeType{ model.FeatureTypeTypeElectricalConnection, model.FeatureTypeTypeMeasurement, }, - }, + }) } u := usecase.NewUseCaseBase( @@ -175,74 +200,80 @@ func (e *MPC) AddFeatures() { } } - if e.energyConfig.ValueSourceConsumption != nil { - e.acEnergyConsumed = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeWh), - ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), - }) - if e.energyConfig.ValueConstraintsConsumption != nil { - e.energyConfig.ValueConstraintsConsumption.MeasurementId = e.acEnergyConsumed - constraints = append(constraints, *e.energyConfig.ValueConstraintsConsumption) - } - } - - if e.energyConfig.ValueSourceProduction != nil { - e.acEnergyProduced = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeWh), - ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), - }) - if e.energyConfig.ValueConstraintsProduction != nil { - e.energyConfig.ValueConstraintsProduction.MeasurementId = e.acEnergyProduced - constraints = append(constraints, *e.energyConfig.ValueConstraintsProduction) + if e.energyConfig != nil { + if e.energyConfig.ValueSourceConsumption != nil { + e.acEnergyConsumed = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeWh), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), + }) + if e.energyConfig.ValueConstraintsConsumption != nil { + e.energyConfig.ValueConstraintsConsumption.MeasurementId = e.acEnergyConsumed + constraints = append(constraints, *e.energyConfig.ValueConstraintsConsumption) + } } - } - acCurrentConstraints := []*model.MeasurementConstraintsDataType{ - e.currentConfig.ValueConstraintsPhaseA, - e.currentConfig.ValueConstraintsPhaseB, - e.currentConfig.ValueConstraintsPhaseC, - } - for id := 0; id < len(e.acCurrent); id++ { - if e.powerConfig.SupportsPhases(phases[id]) { - e.acCurrent[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + if e.energyConfig.ValueSourceProduction != nil { + e.acEnergyProduced = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeA), - ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + Unit: util.Ptr(model.UnitOfMeasurementTypeWh), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), }) - if acCurrentConstraints[id] != nil { - acCurrentConstraints[id].MeasurementId = e.acCurrent[id] - constraints = append(constraints, *acCurrentConstraints[id]) + if e.energyConfig.ValueConstraintsProduction != nil { + e.energyConfig.ValueConstraintsProduction.MeasurementId = e.acEnergyProduced + constraints = append(constraints, *e.energyConfig.ValueConstraintsProduction) } } } - acVoltageConstraints := []*model.MeasurementConstraintsDataType{ - e.voltageConfig.ValueConstraintsPhaseA, - e.voltageConfig.ValueConstraintsPhaseB, - e.voltageConfig.ValueConstraintsPhaseC, - e.voltageConfig.ValueConstraintsPhaseAToB, - e.voltageConfig.ValueConstraintsPhaseBToC, - e.voltageConfig.ValueConstraintsPhaseCToA, - } - for id := 0; id < len(e.acVoltage); id++ { - if e.powerConfig.SupportsPhases(phases[id]) { - if len(phases[id]) == 2 && !e.voltageConfig.SupportPhaseToPhase { - continue + if e.currentConfig != nil { + acCurrentConstraints := []*model.MeasurementConstraintsDataType{ + e.currentConfig.ValueConstraintsPhaseA, + e.currentConfig.ValueConstraintsPhaseB, + e.currentConfig.ValueConstraintsPhaseC, + } + for id := 0; id < len(e.acCurrent); id++ { + if e.powerConfig.SupportsPhases(phases[id]) { + e.acCurrent[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeA), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + }) + if acCurrentConstraints[id] != nil { + acCurrentConstraints[id].MeasurementId = e.acCurrent[id] + constraints = append(constraints, *acCurrentConstraints[id]) + } } - e.acVoltage[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeV), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), - }) - if acVoltageConstraints[id] != nil { - acVoltageConstraints[id].MeasurementId = e.acVoltage[id] - constraints = append(constraints, *acVoltageConstraints[id]) + } + } + + if e.voltageConfig != nil { + acVoltageConstraints := []*model.MeasurementConstraintsDataType{ + e.voltageConfig.ValueConstraintsPhaseA, + e.voltageConfig.ValueConstraintsPhaseB, + e.voltageConfig.ValueConstraintsPhaseC, + e.voltageConfig.ValueConstraintsPhaseAToB, + e.voltageConfig.ValueConstraintsPhaseBToC, + e.voltageConfig.ValueConstraintsPhaseCToA, + } + for id := 0; id < len(e.acVoltage); id++ { + if e.powerConfig.SupportsPhases(phases[id]) { + if len(phases[id]) == 2 && !e.voltageConfig.SupportPhaseToPhase { + continue + } + e.acVoltage[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + if acVoltageConstraints[id] != nil { + acVoltageConstraints[id].MeasurementId = e.acVoltage[id] + constraints = append(constraints, *acVoltageConstraints[id]) + } } } } diff --git a/usecases/mu/mpc/usecase_test.go b/usecases/mu/mpc/usecase_test.go new file mode 100644 index 00000000..af42d9f2 --- /dev/null +++ b/usecases/mu/mpc/usecase_test.go @@ -0,0 +1,151 @@ +package mpc + +import ( + "testing" + "time" + + "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/mocks" + "github.com/enbility/eebus-go/service" + shipapi "github.com/enbility/ship-go/api" + "github.com/enbility/ship-go/cert" + spineapi "github.com/enbility/spine-go/api" + spinemocks "github.com/enbility/spine-go/mocks" + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" +) + +func TestBasicSuite(t *testing.T) { + suite.Run(t, new(BasicSuite)) +} + +type BasicSuite struct { + suite.Suite + + service api.ServiceInterface + + remoteDevice spineapi.DeviceRemoteInterface + mockRemoteEntity *spinemocks.EntityRemoteInterface + monitoredEntity spineapi.EntityRemoteInterface + loadControlFeature, + deviceDiagnosisFeature, + deviceConfigurationFeature spineapi.FeatureLocalInterface + + eventCalled bool +} + +func (s *BasicSuite) Event(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event api.EventType) { + s.eventCalled = true +} + +func (s *BasicSuite) BeforeTest(suiteName, testName string) { + s.eventCalled = false + cert, _ := cert.CreateCertificate("test", "test", "DE", "test") + configuration, _ := api.NewConfiguration( + "test", "test", "test", "test", + []shipapi.DeviceCategoryType{shipapi.DeviceCategoryTypeEnergyManagementSystem}, + model.DeviceTypeTypeEnergyManagementSystem, + []model.EntityTypeType{model.EntityTypeTypeInverter}, + 9999, cert, time.Second*4) + + serviceHandler := mocks.NewServiceReaderInterface(s.T()) + serviceHandler.EXPECT().ServicePairingDetailUpdate(mock.Anything, mock.Anything).Return().Maybe() + + s.service = service.NewService(configuration, serviceHandler) + _ = s.service.Setup() + + mockRemoteDevice := spinemocks.NewDeviceRemoteInterface(s.T()) + s.mockRemoteEntity = spinemocks.NewEntityRemoteInterface(s.T()) + mockRemoteFeature := spinemocks.NewFeatureRemoteInterface(s.T()) + mockRemoteDevice.EXPECT().FeatureByEntityTypeAndRole(mock.Anything, mock.Anything, mock.Anything).Return(mockRemoteFeature).Maybe() + mockRemoteDevice.EXPECT().Ski().Return(remoteSki).Maybe() + s.mockRemoteEntity.EXPECT().Device().Return(mockRemoteDevice).Maybe() + s.mockRemoteEntity.EXPECT().EntityType().Return(mock.Anything).Maybe() + entityAddress := &model.EntityAddressType{} + s.mockRemoteEntity.EXPECT().Address().Return(entityAddress).Maybe() + mockRemoteFeature.EXPECT().DataCopy(mock.Anything).Return(mock.Anything).Maybe() + mockRemoteFeature.EXPECT().Address().Return(&model.FeatureAddressType{}).Maybe() + mockRemoteFeature.EXPECT().Operations().Return(nil).Maybe() +} + +func (s *BasicSuite) Test_MpcOptionalParameters() { + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + + // required + var monitorPowerConfig = MonitorPowerConfig{ + ConnectedPhases: ConnectedPhasesABC, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + // the following 4 parameters are optional and can be nil + var monitorEnergyConfig = MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + var monitorCurrentConfig = MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + var monitorVoltageConfig = MonitorVoltageConfig{ + SupportPhaseToPhase: true, + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + var monitorFrequencyConfig = MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + } + + numOptionalParams := 4 + + // iterate over all permutations of nil/set + for i := 0; i < (1 << numOptionalParams); i++ { + // Determine which parameters to set + var optEnergyConfig *MonitorEnergyConfig + var optCurrentConfig *MonitorCurrentConfig + var optVoltageConfig *MonitorVoltageConfig + var optFrequencyConfig *MonitorFrequencyConfig + if i&1 != 0 { + optEnergyConfig = &monitorEnergyConfig + } + if i&2 != 0 { + optCurrentConfig = &monitorCurrentConfig + } + if i&4 != 0 { + optVoltageConfig = &monitorVoltageConfig + } + if i&8 != 0 { + optFrequencyConfig = &monitorFrequencyConfig + } + + mpc, err := NewMPC( + localEntity, + s.Event, + &monitorPowerConfig, + optEnergyConfig, + optCurrentConfig, + optVoltageConfig, + optFrequencyConfig, + ) + + assert.Nil(s.T(), err) + + mpc.AddFeatures() + mpc.AddUseCase() + } +} From f3bcf8ff7c52db133ea1774fc3ee5db2bce95e0f Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 20 Nov 2024 09:33:10 +0100 Subject: [PATCH 07/61] refactor the addFeatures method of the mpc --- usecases/mu/mpc/usecase.go | 597 ++++++++++++++++++------------------- 1 file changed, 283 insertions(+), 314 deletions(-) diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index 795c55ae..7ae35d79 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -154,19 +154,66 @@ func (e *MPC) AddFeatures() { measurements, err := server.NewMeasurement(e.LocalEntity) if err != nil { - panic(err) + // TODO fix AddFeatures()? } - var phases = [][]string{ - {"a"}, - {"b"}, - {"c"}, - {"a", "b"}, - {"b", "c"}, - {"c", "a"}, + electricalConnection, err := server.NewElectricalConnection(e.LocalEntity) + if err != nil { + // TODO fix AddFeatures()? + } + + electricalConnectionId := model.ElectricalConnectionIdType(0) + + electricalConnectionDescription := model.ElectricalConnectionDescriptionDataType{ + ElectricalConnectionId: &electricalConnectionId, + PowerSupplyType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + PositiveEnergyDirection: util.Ptr(model.EnergyDirectionTypeConsume), + } + + if err := electricalConnection.AddDescription(electricalConnectionDescription); err != nil { + // TODO return error + } + + constraints := make([]model.MeasurementConstraintsDataType, 0) + + configMethods := []func( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, + ) error{ + e.configureMonitorPower, + e.configureMonitorEnergy, + e.configureMonitorCurrent, + e.configureMonitorVoltage, + e.configureMonitorFrequency, + } + + for _, configMethod := range configMethods { + if err := configMethod(measurements, electricalConnection, &electricalConnectionId, &constraints); err != nil { + // TODO return error + } + } + + if len(constraints) > 0 { + measurementFeature.UpdateData( + model.FunctionTypeMeasurementConstraintsListData, + &model.MeasurementConstraintsListDataType{ + MeasurementConstraintsData: constraints, + }, nil, nil, + ) } +} - var constraints = make([]model.MeasurementConstraintsDataType, 0) +func (e *MPC) configureMonitorPower( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, +) error { + if e.powerConfig == nil { + return nil // TODO return error if not optional + } e.acPowerTotal = measurements.AddDescription(model.MeasurementDescriptionDataType{ MeasurementType: util.Ptr(model.MeasurementTypeTypePower), @@ -177,7 +224,22 @@ func (e *MPC) AddFeatures() { if e.powerConfig.ValueConstraintsTotal != nil { e.powerConfig.ValueConstraintsTotal.MeasurementId = e.acPowerTotal - constraints = append(constraints, *e.powerConfig.ValueConstraintsTotal) + *measurementsConstraintData = append(*measurementsConstraintData, *e.powerConfig.ValueConstraintsTotal) + } + + parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: e.acPowerTotal, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameType(e.powerConfig.ConnectedPhases)), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + + parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) + if parameterDescriptionId == nil { + // TODO return error } acPowerConstraints := []*model.MeasurementConstraintsDataType{ @@ -185,6 +247,13 @@ func (e *MPC) AddFeatures() { e.powerConfig.ValueConstraintsPhaseB, e.powerConfig.ValueConstraintsPhaseC, } + + acMeasuredPhases := []*model.ElectricalConnectionPhaseNameType{ + util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + } + for id := 0; id < len(e.acPower); id++ { if e.powerConfig.SupportsPhases(phases[id]) { e.acPower[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ @@ -193,368 +262,259 @@ func (e *MPC) AddFeatures() { Unit: util.Ptr(model.UnitOfMeasurementTypeW), ScopeType: util.Ptr(model.ScopeTypeTypeACPower), }) + if acPowerConstraints[id] != nil { acPowerConstraints[id].MeasurementId = e.acPower[id] - constraints = append(constraints, *acPowerConstraints[id]) + *measurementsConstraintData = append(*measurementsConstraintData, *acPowerConstraints[id]) } - } - } - if e.energyConfig != nil { - if e.energyConfig.ValueSourceConsumption != nil { - e.acEnergyConsumed = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeWh), - ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), - }) - if e.energyConfig.ValueConstraintsConsumption != nil { - e.energyConfig.ValueConstraintsConsumption.MeasurementId = e.acEnergyConsumed - constraints = append(constraints, *e.energyConfig.ValueConstraintsConsumption) + parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: e.acPower[id], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: acMeasuredPhases[id], + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), } - } - if e.energyConfig.ValueSourceProduction != nil { - e.acEnergyProduced = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeWh), - ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), - }) - if e.energyConfig.ValueConstraintsProduction != nil { - e.energyConfig.ValueConstraintsProduction.MeasurementId = e.acEnergyProduced - constraints = append(constraints, *e.energyConfig.ValueConstraintsProduction) + parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) + if parameterDescriptionId == nil { + // TODO return error } } } - if e.currentConfig != nil { - acCurrentConstraints := []*model.MeasurementConstraintsDataType{ - e.currentConfig.ValueConstraintsPhaseA, - e.currentConfig.ValueConstraintsPhaseB, - e.currentConfig.ValueConstraintsPhaseC, - } - for id := 0; id < len(e.acCurrent); id++ { - if e.powerConfig.SupportsPhases(phases[id]) { - e.acCurrent[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeA), - ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), - }) - if acCurrentConstraints[id] != nil { - acCurrentConstraints[id].MeasurementId = e.acCurrent[id] - constraints = append(constraints, *acCurrentConstraints[id]) - } - } - } - } + return nil +} - if e.voltageConfig != nil { - acVoltageConstraints := []*model.MeasurementConstraintsDataType{ - e.voltageConfig.ValueConstraintsPhaseA, - e.voltageConfig.ValueConstraintsPhaseB, - e.voltageConfig.ValueConstraintsPhaseC, - e.voltageConfig.ValueConstraintsPhaseAToB, - e.voltageConfig.ValueConstraintsPhaseBToC, - e.voltageConfig.ValueConstraintsPhaseCToA, - } - for id := 0; id < len(e.acVoltage); id++ { - if e.powerConfig.SupportsPhases(phases[id]) { - if len(phases[id]) == 2 && !e.voltageConfig.SupportPhaseToPhase { - continue - } - e.acVoltage[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeV), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), - }) - if acVoltageConstraints[id] != nil { - acVoltageConstraints[id].MeasurementId = e.acVoltage[id] - constraints = append(constraints, *acVoltageConstraints[id]) - } - } - } +func (e *MPC) configureMonitorEnergy( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, +) error { + if e.energyConfig == nil { + return nil } - if e.frequencyConfig != nil { - e.acFrequency = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), + if e.energyConfig.ValueSourceConsumption != nil { + e.acEnergyConsumed = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeHz), - ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), + Unit: util.Ptr(model.UnitOfMeasurementTypeWh), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), }) - if e.frequencyConfig.ValueConstraints != nil { - e.frequencyConfig.ValueConstraints.MeasurementId = e.acFrequency - constraints = append(constraints, *e.frequencyConfig.ValueConstraints) + if e.energyConfig.ValueConstraintsConsumption != nil { + e.energyConfig.ValueConstraintsConsumption.MeasurementId = e.acEnergyConsumed + *measurementsConstraintData = append(*measurementsConstraintData, *e.energyConfig.ValueConstraintsConsumption) } - } - - electricalConnection, err := server.NewElectricalConnection(e.LocalEntity) - if err != nil { - panic(err) - } - idEc1 := model.ElectricalConnectionIdType(0) - ec1 := model.ElectricalConnectionDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - PowerSupplyType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - PositiveEnergyDirection: util.Ptr(model.EnergyDirectionTypeConsume), - } - if err := electricalConnection.AddDescription(ec1); err != nil { - panic(err) - } - - p1 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acPowerTotal, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameType(e.powerConfig.ConnectedPhases)), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP1 := electricalConnection.AddParameterDescription(p1) - if idP1 == nil { - panic("error adding parameter description") - } - - if e.acPower[0] != nil { - p21 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acPower[0], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP21 := electricalConnection.AddParameterDescription(p21) - if idP21 == nil { - panic("error adding parameter description") + parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: e.acEnergyConsumed, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), } - } - if e.acPower[1] != nil { - p22 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acPower[1], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP22 := electricalConnection.AddParameterDescription(p22) - if idP22 == nil { - panic("error adding parameter description") + parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) + if parameterDescriptionId == nil { + // TODO return error } } - if e.acPower[2] != nil { - p23 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acPower[2], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP23 := electricalConnection.AddParameterDescription(p23) - if idP23 == nil { - panic("error adding parameter description") - } - } + if e.energyConfig.ValueSourceProduction != nil { + e.acEnergyProduced = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeWh), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), + }) - if e.acEnergyConsumed != nil { - p3 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acEnergyConsumed, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - } - idP3 := electricalConnection.AddParameterDescription(p3) - if idP3 == nil { - panic("error adding parameter description") + if e.energyConfig.ValueConstraintsProduction != nil { + e.energyConfig.ValueConstraintsProduction.MeasurementId = e.acEnergyProduced + *measurementsConstraintData = append(*measurementsConstraintData, *e.energyConfig.ValueConstraintsProduction) } - } - if e.acEnergyProduced != nil { p4 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), + ElectricalConnectionId: electricalConnectionId, MeasurementId: e.acEnergyProduced, VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), } idP4 := electricalConnection.AddParameterDescription(p4) if idP4 == nil { - panic("error adding parameter description") + // TODO return error } } - if e.acCurrent[0] != nil { - p51 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acCurrent[0], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP51 := electricalConnection.AddParameterDescription(p51) - if idP51 == nil { - panic("error adding parameter description") - } + return nil +} + +func (e *MPC) configureMonitorCurrent( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, +) error { + if e.currentConfig == nil { + return nil // TODO? } - if e.acCurrent[1] != nil { - p52 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acCurrent[1], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP52 := electricalConnection.AddParameterDescription(p52) - if idP52 == nil { - panic("error adding parameter description") - } + acCurrentConstraints := []*model.MeasurementConstraintsDataType{ + e.currentConfig.ValueConstraintsPhaseA, + e.currentConfig.ValueConstraintsPhaseB, + e.currentConfig.ValueConstraintsPhaseC, } - if e.acCurrent[2] != nil { - p53 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acCurrent[2], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP53 := electricalConnection.AddParameterDescription(p53) - if idP53 == nil { - panic("error adding parameter description") - } + acMeasuredPhases := []*model.ElectricalConnectionPhaseNameType{ + util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + util.Ptr(model.ElectricalConnectionPhaseNameTypeC), } - if e.acVoltage[0] != nil { - p61 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acVoltage[0], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP61 := electricalConnection.AddParameterDescription(p61) - if idP61 == nil { - panic("error adding parameter description") + for id := 0; id < len(e.acCurrent); id++ { + if e.powerConfig.SupportsPhases(phases[id]) { + e.acCurrent[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeA), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + }) + + if acCurrentConstraints[id] != nil { + acCurrentConstraints[id].MeasurementId = e.acCurrent[id] + *measurementsConstraintData = append(*measurementsConstraintData, *acCurrentConstraints[id]) + } + + parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: e.acCurrent[id], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: acMeasuredPhases[id], + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + + parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) + if parameterDescriptionId == nil { + // TODO return error + } } } - if e.acVoltage[1] != nil { - p62 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acVoltage[1], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP62 := electricalConnection.AddParameterDescription(p62) - if idP62 == nil { - panic("error adding parameter description") - } + return nil +} + +func (e *MPC) configureMonitorVoltage( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, +) error { + if e.voltageConfig == nil { + return nil } - if e.acVoltage[2] != nil { - p63 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acVoltage[2], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP63 := electricalConnection.AddParameterDescription(p63) - if idP63 == nil { - panic("error adding parameter description") - } + acVoltagePhasesFrom := []*model.ElectricalConnectionPhaseNameType{ + util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + util.Ptr(model.ElectricalConnectionPhaseNameTypeC), } - if e.acVoltage[3] != nil { - p64 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acVoltage[3], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP64 := electricalConnection.AddParameterDescription(p64) - if idP64 == nil { - panic("error adding parameter description") - } + acVoltagePhasesTo := []*model.ElectricalConnectionPhaseNameType{ + util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + util.Ptr(model.ElectricalConnectionPhaseNameTypeA), } - if e.acVoltage[4] != nil { - p65 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acVoltage[4], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP65 := electricalConnection.AddParameterDescription(p65) - if idP65 == nil { - panic("error adding parameter description") - } + acVoltageConstraints := []*model.MeasurementConstraintsDataType{ + e.voltageConfig.ValueConstraintsPhaseA, + e.voltageConfig.ValueConstraintsPhaseB, + e.voltageConfig.ValueConstraintsPhaseC, + e.voltageConfig.ValueConstraintsPhaseAToB, + e.voltageConfig.ValueConstraintsPhaseBToC, + e.voltageConfig.ValueConstraintsPhaseCToA, } - if e.acVoltage[5] != nil { - p66 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acVoltage[5], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } - idP66 := electricalConnection.AddParameterDescription(p66) - if idP66 == nil { - panic("error adding parameter description") + for id := 0; id < len(e.acVoltage); id++ { + if e.powerConfig.SupportsPhases(phases[id]) { + if len(phases[id]) == 2 && !e.voltageConfig.SupportPhaseToPhase { + continue + } + + e.acVoltage[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + + if acVoltageConstraints[id] != nil { + acVoltageConstraints[id].MeasurementId = e.acVoltage[id] + *measurementsConstraintData = append(*measurementsConstraintData, *acVoltageConstraints[id]) + } + + parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: e.acVoltage[id], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: acVoltagePhasesFrom[id], + AcMeasuredInReferenceTo: acVoltagePhasesTo[id], + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + + parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) + if parameterDescriptionId == nil { + // TODO return error + } } } - if e.acFrequency != nil { - p7 := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.acFrequency, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - } - idP7 := electricalConnection.AddParameterDescription(p7) - if idP7 == nil { - panic("error adding parameter description") - } + return nil +} + +func (e *MPC) configureMonitorFrequency( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, +) error { + if e.frequencyConfig == nil { + return nil } - if len(constraints) > 0 { - measurementFeature.UpdateData( - model.FunctionTypeMeasurementConstraintsListData, - &model.MeasurementConstraintsListDataType{ - MeasurementConstraintsData: constraints, - }, nil, nil, - ) + e.acFrequency = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeHz), + ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), + }) + + if e.frequencyConfig.ValueConstraints != nil { + e.frequencyConfig.ValueConstraints.MeasurementId = e.acFrequency + *measurementsConstraintData = append(*measurementsConstraintData, *e.frequencyConfig.ValueConstraints) } + + parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: e.acFrequency, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + } + + parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) + if parameterDescriptionId == nil { + // TODO return error + } + + return nil } func (e *MPC) getMeasurementDataForId(id *model.MeasurementIdType) (float64, error) { @@ -603,3 +563,12 @@ func measurementData( return measurement } + +var phases = [][]string{ + {"a"}, + {"b"}, + {"c"}, + {"a", "b"}, + {"b", "c"}, + {"c", "a"}, +} From 5a4705c6eded8406bcab980fc95414d17fbe199e Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 20 Nov 2024 09:49:20 +0100 Subject: [PATCH 08/61] Add test for the mpc-power-config PhaseConnection-function --- usecases/mu/mpc/config_test.go | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 usecases/mu/mpc/config_test.go diff --git a/usecases/mu/mpc/config_test.go b/usecases/mu/mpc/config_test.go new file mode 100644 index 00000000..f8fccef4 --- /dev/null +++ b/usecases/mu/mpc/config_test.go @@ -0,0 +1,46 @@ +package mpc + +import ( + "github.com/stretchr/testify/assert" +) + +func (s *MuMPCSuite) Test_SupportsPhases() { + allowedConstellations := map[ConnectedPhases][][]string{ + ConnectedPhasesA: {{"a"}}, + ConnectedPhasesB: {{"b"}}, + ConnectedPhasesC: {{"c"}}, + ConnectedPhasesAB: {{"a"}, {"b"}, {"a", "b"}}, + ConnectedPhasesBC: {{"b"}, {"c"}, {"b", "c"}}, + ConnectedPhasesCA: {{"a"}, {"c"}, {"a", "c"}}, + ConnectedPhasesABC: {{"a"}, {"b"}, {"c"}, {"a", "b"}, {"b", "c"}, {"a", "c"}, {"a", "b", "c"}}, + } + + for constellation, phases := range allowedConstellations { + config := MonitorPowerConfig{ + ConnectedPhases: constellation, + } + + for _, phase := range phases { + assert.True(s.T(), config.SupportsPhases(phase)) + } + } + + notAllowedConstellations := map[ConnectedPhases][]string{ + ConnectedPhasesA: {"b", "c", "ab", "bc", "ac", "abc"}, + ConnectedPhasesB: {"a", "c", "ab", "bc", "ac", "abc"}, + ConnectedPhasesC: {"a", "b", "ab", "bc", "ac", "abc"}, + ConnectedPhasesAB: {"c", "ac", "abc"}, + ConnectedPhasesBC: {"a", "ab", "abc"}, + ConnectedPhasesCA: {"b", "bc", "abc"}, + } + + for constellation, notSupportedPhases := range notAllowedConstellations { + config := MonitorPowerConfig{ + ConnectedPhases: constellation, + } + + for _, phase := range notSupportedPhases { + assert.False(s.T(), config.SupportsPhases([]string{phase})) + } + } +} From 6bc2f6484b721dec32b4a6270417d697b8a80369 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 20 Nov 2024 09:57:55 +0100 Subject: [PATCH 09/61] Ignore case for the SupportPhases function of the power config. --- usecases/mu/mpc/config.go | 4 +++- usecases/mu/mpc/config_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/usecases/mu/mpc/config.go b/usecases/mu/mpc/config.go index 52113791..9b5314c1 100644 --- a/usecases/mu/mpc/config.go +++ b/usecases/mu/mpc/config.go @@ -85,11 +85,13 @@ type MonitorFrequencyConfig struct { ValueConstraints *model.MeasurementConstraintsDataType // The constraints for the frequency values (optional can be nil) } +// SupportsPhases checks if the config supports the given phases +// e.g. SupportsPhases([]string{"a", "B"}) will return true if the config has ConnectedPhases set to "ab" or "abc" func (c *MonitorPowerConfig) SupportsPhases(phase []string) bool { phasesString := string(c.ConnectedPhases) supports := true for _, p := range phase { - if !strings.Contains(phasesString, p) { + if !strings.Contains(strings.ToLower(phasesString), strings.ToLower(p)) { supports = false break } diff --git a/usecases/mu/mpc/config_test.go b/usecases/mu/mpc/config_test.go index f8fccef4..10d04777 100644 --- a/usecases/mu/mpc/config_test.go +++ b/usecases/mu/mpc/config_test.go @@ -8,11 +8,11 @@ func (s *MuMPCSuite) Test_SupportsPhases() { allowedConstellations := map[ConnectedPhases][][]string{ ConnectedPhasesA: {{"a"}}, ConnectedPhasesB: {{"b"}}, - ConnectedPhasesC: {{"c"}}, + ConnectedPhasesC: {{"C"}}, ConnectedPhasesAB: {{"a"}, {"b"}, {"a", "b"}}, - ConnectedPhasesBC: {{"b"}, {"c"}, {"b", "c"}}, - ConnectedPhasesCA: {{"a"}, {"c"}, {"a", "c"}}, - ConnectedPhasesABC: {{"a"}, {"b"}, {"c"}, {"a", "b"}, {"b", "c"}, {"a", "c"}, {"a", "b", "c"}}, + ConnectedPhasesBC: {{"b"}, {"c"}, {"B", "c"}}, + ConnectedPhasesCA: {{"a"}, {"c"}, {"A", "C"}}, + ConnectedPhasesABC: {{"a"}, {"b"}, {"c"}, {"a", "b"}, {"b", "c"}, {"a", "c"}, {"A", "b", "c"}}, } for constellation, phases := range allowedConstellations { From 2f71c8dcffbbe46ca5117bd5b49ef3595708095a Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 20 Nov 2024 11:07:50 +0100 Subject: [PATCH 10/61] Add more tests with mocks --- usecases/mu/mpc/public_abc_test.go | 145 +++++++++++++++++++++++++ usecases/mu/mpc/public_bc_test.go | 165 +++++++++++++++++++++++++++++ usecases/mu/mpc/public_test.go | 94 ---------------- usecases/mu/mpc/testhelper_test.go | 71 ++++++------- 4 files changed, 340 insertions(+), 135 deletions(-) create mode 100644 usecases/mu/mpc/public_abc_test.go create mode 100644 usecases/mu/mpc/public_bc_test.go delete mode 100644 usecases/mu/mpc/public_test.go diff --git a/usecases/mu/mpc/public_abc_test.go b/usecases/mu/mpc/public_abc_test.go new file mode 100644 index 00000000..a4d30f8a --- /dev/null +++ b/usecases/mu/mpc/public_abc_test.go @@ -0,0 +1,145 @@ +package mpc + +import ( + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" + "testing" + "time" +) + +type MuMpcAbcSuite struct { + suite.Suite + *MuMPCSuite +} + +func TestMuMpcAbcSuite(t *testing.T) { + suite.Run(t, new(MuMpcAbcSuite)) +} + +func (s *MuMpcAbcSuite) BeforeTest(suiteName, testName string) { + s.MuMPCSuite = NewMuMPCSuite( + &s.Suite, + &MonitorPowerConfig{ + ConnectedPhases: ConnectedPhasesABC, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorVoltageConfig{ + SupportPhaseToPhase: true, + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + }, + ) + s.MuMPCSuite.BeforeTest(suiteName, testName) +} + +func (s *MuMpcAbcSuite) Test_Power() { + err := s.sut.Update( + s.sut.UpdateDataPowerTotal(5.0, util.Ptr(time.Now()), nil), + ) + assert.Nil(s.T(), err) + + power, err := s.sut.Power() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, power) +} + +func (s *MuMpcAbcSuite) Test_PowerPerPhase() { + err := s.sut.Update( + s.sut.UpdateDataPowerPhaseA(5.0, util.Ptr(time.Now()), nil), + s.sut.UpdateDataPowerPhaseB(6.0, util.Ptr(time.Now()), nil), + s.sut.UpdateDataPowerPhaseC(7.0, util.Ptr(time.Now()), util.Ptr(model.MeasurementValueStateTypeError)), + ) + assert.Nil(s.T(), err) + + powerPerPhases, err := s.sut.PowerPerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 6.0, 7.0}, powerPerPhases) +} + +func (s *MuMpcAbcSuite) Test_EnergyConsumed() { + err := s.sut.Update( + s.sut.UpdateDataEnergyConsumed(5.0, util.Ptr(time.Now()), nil, util.Ptr(time.Now()), util.Ptr(time.Now())), + ) + assert.Nil(s.T(), err) + + energyConsumed, err := s.sut.EnergyConsumed() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, energyConsumed) +} + +func (s *MuMpcAbcSuite) Test_EnergyProduced() { + err := s.sut.Update( + s.sut.UpdateDataEnergyProduced(5.0, nil, nil, nil, nil), + ) + assert.Nil(s.T(), err) + + energyProduced, err := s.sut.EnergyProduced() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, energyProduced) +} + +func (s *MuMpcAbcSuite) Test_CurrentPerPhase() { + err := s.sut.Update( + s.sut.UpdateDataCurrentPhaseA(5.0, nil, nil), + s.sut.UpdateDataCurrentPhaseB(3.0, nil, nil), + s.sut.UpdateDataCurrentPhaseC(1.0, nil, nil), + ) + assert.Nil(s.T(), err) + + currentPerPhases, err := s.sut.CurrentPerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 3.0, 1.0}, currentPerPhases) +} + +func (s *MuMpcAbcSuite) Test_VoltagePerPhase() { + err := s.sut.Update( + s.sut.UpdateDataVoltagePhaseA(5.0, nil, nil), + s.sut.UpdateDataVoltagePhaseB(6.0, nil, nil), + s.sut.UpdateDataVoltagePhaseC(7.0, nil, nil), + s.sut.UpdateDataVoltagePhaseAToB(8.0, nil, nil), + s.sut.UpdateDataVoltagePhaseBToC(9.0, nil, nil), + s.sut.UpdateDataVoltagePhaseCToA(10.0, nil, nil), + ) + assert.Nil(s.T(), err) + + voltagePerPhases, err := s.sut.VoltagePerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, voltagePerPhases) +} + +func (s *MuMpcAbcSuite) Test_Frequency() { + err := s.sut.Update( + s.sut.UpdateDataFrequency(5.0, nil, nil), + ) + assert.Nil(s.T(), err) + + frequency, err := s.sut.Frequency() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, frequency) +} diff --git a/usecases/mu/mpc/public_bc_test.go b/usecases/mu/mpc/public_bc_test.go new file mode 100644 index 00000000..a6a29d5f --- /dev/null +++ b/usecases/mu/mpc/public_bc_test.go @@ -0,0 +1,165 @@ +package mpc + +import ( + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" + "testing" + "time" +) + +type MuMpcBcSuite struct { + suite.Suite + *MuMPCSuite +} + +func TestMuMpcAbSuite(t *testing.T) { + suite.Run(t, new(MuMpcBcSuite)) +} + +func (s *MuMpcBcSuite) BeforeTest(suiteName, testName string) { + s.MuMPCSuite = NewMuMPCSuite( + &s.Suite, + &MonitorPowerConfig{ + ConnectedPhases: ConnectedPhasesBC, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorVoltageConfig{ + SupportPhaseToPhase: true, + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + }, + ) + s.MuMPCSuite.BeforeTest(suiteName, testName) +} + +func (s *MuMpcBcSuite) Test_Power() { + err := s.sut.Update( + s.sut.UpdateDataPowerTotal(5.0, util.Ptr(time.Now()), nil), + ) + assert.Nil(s.T(), err) + + power, err := s.sut.Power() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, power) +} + +func (s *MuMpcBcSuite) Test_PowerPerPhase() { + err := s.sut.Update( + s.sut.UpdateDataPowerPhaseB(6.0, util.Ptr(time.Now()), nil), + s.sut.UpdateDataPowerPhaseC(7.0, util.Ptr(time.Now()), util.Ptr(model.MeasurementValueStateTypeError)), + ) + assert.Nil(s.T(), err) + + powerPerPhases, err := s.sut.PowerPerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{6.0, 7.0}, powerPerPhases) + + assert.Panics(s.T(), func() { + err = s.sut.Update( + s.sut.UpdateDataPowerPhaseA(5.0, util.Ptr(time.Now()), nil), + ) + }) +} + +func (s *MuMpcBcSuite) Test_EnergyConsumed() { + err := s.sut.Update( + s.sut.UpdateDataEnergyConsumed(5.0, util.Ptr(time.Now()), nil, util.Ptr(time.Now()), util.Ptr(time.Now())), + ) + assert.Nil(s.T(), err) + + energyConsumed, err := s.sut.EnergyConsumed() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, energyConsumed) +} + +func (s *MuMpcBcSuite) Test_EnergyProduced() { + err := s.sut.Update( + s.sut.UpdateDataEnergyProduced(5.0, nil, nil, nil, nil), + ) + assert.Nil(s.T(), err) + + energyProduced, err := s.sut.EnergyProduced() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, energyProduced) +} + +func (s *MuMpcBcSuite) Test_CurrentPerPhase() { + err := s.sut.Update( + s.sut.UpdateDataCurrentPhaseB(3.0, nil, nil), + s.sut.UpdateDataCurrentPhaseC(1.0, nil, nil), + ) + assert.Nil(s.T(), err) + + currentPerPhases, err := s.sut.CurrentPerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{3.0, 1.0}, currentPerPhases) + + assert.Panics(s.T(), func() { + err = s.sut.Update( + s.sut.UpdateDataCurrentPhaseA(5.0, nil, nil), + ) + }) +} + +func (s *MuMpcBcSuite) Test_VoltagePerPhase() { + err := s.sut.Update( + s.sut.UpdateDataVoltagePhaseB(6.0, nil, nil), + s.sut.UpdateDataVoltagePhaseC(7.0, nil, nil), + s.sut.UpdateDataVoltagePhaseBToC(9.0, nil, nil), + ) + assert.Nil(s.T(), err) + + voltagePerPhases, err := s.sut.VoltagePerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{6.0, 7.0, 9.0}, voltagePerPhases) + + assert.Panics(s.T(), func() { + _ = s.sut.Update( + s.sut.UpdateDataVoltagePhaseA(5.0, nil, nil), + ) + }) + + assert.Panics(s.T(), func() { + _ = s.sut.Update( + s.sut.UpdateDataVoltagePhaseAToB(8.0, nil, nil), + ) + }) + + assert.Panics(s.T(), func() { + _ = s.sut.Update( + s.sut.UpdateDataVoltagePhaseCToA(10.0, nil, nil), + ) + }) +} + +func (s *MuMpcBcSuite) Test_Frequency() { + err := s.sut.Update( + s.sut.UpdateDataFrequency(5.0, nil, nil), + ) + assert.Nil(s.T(), err) + + frequency, err := s.sut.Frequency() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, frequency) +} diff --git a/usecases/mu/mpc/public_test.go b/usecases/mu/mpc/public_test.go deleted file mode 100644 index bea94e79..00000000 --- a/usecases/mu/mpc/public_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package mpc - -import ( - "github.com/enbility/spine-go/model" - "github.com/enbility/spine-go/util" - "github.com/stretchr/testify/assert" - "time" -) - -func (s *MuMPCSuite) Test_Power() { - err := s.sut.Update( - s.sut.UpdateDataPowerTotal(5.0, util.Ptr(time.Now()), nil), - ) - assert.Nil(s.T(), err) - - power, err := s.sut.Power() - assert.Nil(s.T(), err) - assert.Equal(s.T(), 5.0, power) -} - -func (s *MuMPCSuite) Test_PowerPerPhase() { - err := s.sut.Update( - s.sut.UpdateDataPowerPhaseA(5.0, util.Ptr(time.Now()), nil), - s.sut.UpdateDataPowerPhaseB(6.0, util.Ptr(time.Now()), nil), - s.sut.UpdateDataPowerPhaseC(7.0, util.Ptr(time.Now()), util.Ptr(model.MeasurementValueStateTypeError)), - ) - assert.Nil(s.T(), err) - - powerPerPhases, err := s.sut.PowerPerPhase() - assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.0, 6.0, 7.0}, powerPerPhases) -} - -func (s *MuMPCSuite) Test_EnergyConsumed() { - err := s.sut.Update( - s.sut.UpdateDataEnergyConsumed(5.0, util.Ptr(time.Now()), nil, util.Ptr(time.Now()), util.Ptr(time.Now())), - ) - assert.Nil(s.T(), err) - - energyConsumed, err := s.sut.EnergyConsumed() - assert.Nil(s.T(), err) - assert.Equal(s.T(), 5.0, energyConsumed) -} - -func (s *MuMPCSuite) Test_EnergyProduced() { - err := s.sut.Update( - s.sut.UpdateDataEnergyProduced(5.0, nil, nil, nil, nil), - ) - assert.Nil(s.T(), err) - - energyProduced, err := s.sut.EnergyProduced() - assert.Nil(s.T(), err) - assert.Equal(s.T(), 5.0, energyProduced) -} - -func (s *MuMPCSuite) Test_CurrentPerPhase() { - err := s.sut.Update( - s.sut.UpdateDataCurrentPhaseA(5.0, nil, nil), - s.sut.UpdateDataCurrentPhaseB(3.0, nil, nil), - s.sut.UpdateDataCurrentPhaseC(1.0, nil, nil), - ) - assert.Nil(s.T(), err) - - currentPerPhases, err := s.sut.CurrentPerPhase() - assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.0, 3.0, 1.0}, currentPerPhases) -} - -func (s *MuMPCSuite) Test_VoltagePerPhase() { - err := s.sut.Update( - s.sut.UpdateDataVoltagePhaseA(5.0, nil, nil), - s.sut.UpdateDataVoltagePhaseB(6.0, nil, nil), - s.sut.UpdateDataVoltagePhaseC(7.0, nil, nil), - s.sut.UpdateDataVoltagePhaseAToB(8.0, nil, nil), - s.sut.UpdateDataVoltagePhaseBToC(9.0, nil, nil), - s.sut.UpdateDataVoltagePhaseCToA(10.0, nil, nil), - ) - assert.Nil(s.T(), err) - - voltagePerPhases, err := s.sut.VoltagePerPhase() - assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, voltagePerPhases) -} - -func (s *MuMPCSuite) Test_Frequency() { - err := s.sut.Update( - s.sut.UpdateDataFrequency(5.0, nil, nil), - ) - assert.Nil(s.T(), err) - - frequency, err := s.sut.Frequency() - assert.Nil(s.T(), err) - assert.Equal(s.T(), 5.0, frequency) -} diff --git a/usecases/mu/mpc/testhelper_test.go b/usecases/mu/mpc/testhelper_test.go index c4b4dde4..2d975a95 100644 --- a/usecases/mu/mpc/testhelper_test.go +++ b/usecases/mu/mpc/testhelper_test.go @@ -1,7 +1,6 @@ package mpc import ( - "testing" "time" "github.com/enbility/eebus-go/api" @@ -12,21 +11,21 @@ import ( spineapi "github.com/enbility/spine-go/api" spinemocks "github.com/enbility/spine-go/mocks" "github.com/enbility/spine-go/model" - "github.com/enbility/spine-go/util" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" ) const remoteSki string = "testremoteski" -func TestMuMPCSuite(t *testing.T) { - suite.Run(t, new(MuMPCSuite)) -} - type MuMPCSuite struct { - suite.Suite + *suite.Suite - sut *MPC + powerConfig *MonitorPowerConfig + energyConfig *MonitorEnergyConfig + currentConfig *MonitorCurrentConfig + voltageConfig *MonitorVoltageConfig + frequencyConfig *MonitorFrequencyConfig + sut *MPC service api.ServiceInterface @@ -40,6 +39,24 @@ type MuMPCSuite struct { eventCalled bool } +func NewMuMPCSuite( + suite *suite.Suite, + powerConfig *MonitorPowerConfig, + energyConfig *MonitorEnergyConfig, + currentConfig *MonitorCurrentConfig, + voltageConfig *MonitorVoltageConfig, + frequencyConfig *MonitorFrequencyConfig, +) *MuMPCSuite { + return &MuMPCSuite{ + Suite: suite, + powerConfig: powerConfig, + energyConfig: energyConfig, + currentConfig: currentConfig, + voltageConfig: voltageConfig, + frequencyConfig: frequencyConfig, + } +} + func (s *MuMPCSuite) Event(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event api.EventType) { s.eventCalled = true } @@ -77,39 +94,11 @@ func (s *MuMPCSuite) BeforeTest(suiteName, testName string) { s.sut, _ = NewMPC( localEntity, s.Event, - &MonitorPowerConfig{ - ConnectedPhases: ConnectedPhasesABC, - ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - }, - &MonitorEnergyConfig{ - ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - }, - &MonitorCurrentConfig{ - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - }, - &MonitorVoltageConfig{ - SupportPhaseToPhase: true, - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - }, - &MonitorFrequencyConfig{ - ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ - ValueRangeMin: model.NewScaledNumberType(0), - ValueRangeMax: model.NewScaledNumberType(100), - ValueStepSize: model.NewScaledNumberType(1), - }), - }, + s.powerConfig, + s.energyConfig, + s.currentConfig, + s.voltageConfig, + s.frequencyConfig, ) s.sut.AddFeatures() s.sut.AddUseCase() From dbef9c250959707fd24407c880e3a2defbec4cb2 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 20 Nov 2024 13:31:01 +0100 Subject: [PATCH 11/61] Remove panic statements with an additional wrapper struct. --- usecases/api/mu_mpc.go | 40 ++--- usecases/mu/mpc/public.go | 234 ++++++++++++++---------------- usecases/mu/mpc/public_bc_test.go | 49 +++---- usecases/mu/mpc/update_helper.go | 77 ++++++++++ usecases/mu/mpc/usecase.go | 31 ---- 5 files changed, 230 insertions(+), 201 deletions(-) create mode 100644 usecases/mu/mpc/update_helper.go diff --git a/usecases/api/mu_mpc.go b/usecases/api/mu_mpc.go index a4ba093f..8d687580 100644 --- a/usecases/api/mu_mpc.go +++ b/usecases/api/mu_mpc.go @@ -91,29 +91,29 @@ type MuMPCInterface interface { // possible errors: // - ErrMissingData if the id is not available // - and others - Update(data ...api.MeasurementDataForID) error + Update(data ...UpdateData) error // Scenario 1 // use UpdateDataPowerTotal in Update to set the momentary active power consumption or production // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // use UpdateDataPowerPhaseA in Update to set the momentary active power consumption or production per phase // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // use UpdateDataPowerPhaseB in Update to set the momentary active power consumption or production per phase // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // use UpdateDataPowerPhaseC in Update to set the momentary active power consumption or production per phase // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // Scenario 2 @@ -127,7 +127,7 @@ type MuMPCInterface interface { valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time, - ) api.MeasurementDataForID + ) UpdateData // use UpdateDataEnergyProduced in Update to set the total feed in energy // The timestamp is optional and can be nil @@ -139,61 +139,67 @@ type MuMPCInterface interface { valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time, - ) api.MeasurementDataForID + ) UpdateData // Scenario 3 // use UpdateDataCurrentPhaseA in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // use UpdateDataCurrentPhaseB in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // use UpdateDataCurrentPhaseC in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // Scenario 4 // use UpdateDataVoltagePhaseA in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // use UpdateDataVoltagePhaseB in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // use UpdateDataVoltagePhaseC in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // use UpdateDataVoltagePhaseAToB in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // use UpdateDataVoltagePhaseBToC in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // use UpdateDataVoltagePhaseCToA in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData // Scenario 5 // use AcFrequency in Update to set the frequency // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.MeasurementDataForID + UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData +} + +type UpdateData interface { + Supported() bool + NotSupportedError() error + MeasurementData() api.MeasurementDataForID } diff --git a/usecases/mu/mpc/public.go b/usecases/mu/mpc/public.go index b3302a7d..2be81e7b 100644 --- a/usecases/mu/mpc/public.go +++ b/usecases/mu/mpc/public.go @@ -3,6 +3,7 @@ package mpc import ( "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" + usecaseapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/spine-go/model" "time" ) @@ -155,12 +156,22 @@ func (e *MPC) Frequency() (float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (e *MPC) Update(measurementDataForIds ...api.MeasurementDataForID) error { +func (e *MPC) Update(updateData ...usecaseapi.UpdateData) error { measurements, err := server.NewMeasurement(e.LocalEntity) if err != nil { return err } + measurementDataForIds := make([]api.MeasurementDataForID, 0) + + for _, measurementDataForId := range updateData { + if !measurementDataForId.Supported() { + return measurementDataForId.NotSupportedError() + } else { + measurementDataForIds = append(measurementDataForIds, measurementDataForId.MeasurementData()) + } + } + return measurements.UpdateDataForIds(measurementDataForIds) } @@ -173,9 +184,11 @@ func (e *MPC) UpdateDataPowerTotal( acPowerTotal float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acPowerTotal is not supported, please check the configuration", + e.acPowerTotal, + measurementData( acPowerTotal, timestamp, e.powerConfig.ValueSourceTotal, @@ -183,8 +196,7 @@ func (e *MPC) UpdateDataPowerTotal( nil, nil, ), - Id: *e.acPowerTotal, - } + ) } // use MPC.UpdateDataPowerPhaseA in MPC.Update to set the momentary active power consumption or production per phase @@ -194,12 +206,11 @@ func (e *MPC) UpdateDataPowerPhaseA( acPowerPhaseA float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acPower[0] == nil { - panic("acPowerPhaseA is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acPowerPhaseA is not supported, please check the configuration", + e.acPower[0], + measurementData( acPowerPhaseA, timestamp, e.powerConfig.ValueSourcePhaseA, @@ -207,8 +218,7 @@ func (e *MPC) UpdateDataPowerPhaseA( nil, nil, ), - Id: *e.acPower[0], - } + ) } // use MPC.UpdateDataPowerPhaseB in MPC.Update to set the momentary active power consumption or production per phase @@ -218,12 +228,11 @@ func (e *MPC) UpdateDataPowerPhaseB( acPowerPhaseB float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acPower[1] == nil { - panic("acPowerPhaseB is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acPowerPhaseB is not supported, please check the configuration", + e.acPower[1], + measurementData( acPowerPhaseB, timestamp, e.powerConfig.ValueSourcePhaseB, @@ -231,8 +240,7 @@ func (e *MPC) UpdateDataPowerPhaseB( nil, nil, ), - Id: *e.acPower[1], - } + ) } // use MPC.UpdateDataPowerPhaseC in MPC.Update to set the momentary active power consumption or production per phase @@ -242,12 +250,11 @@ func (e *MPC) UpdateDataPowerPhaseC( acPowerPhaseC float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acPower[2] == nil { - panic("acPowerPhaseC is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acPowerPhaseC is not supported, please check the configuration", + e.acPower[2], + measurementData( acPowerPhaseC, timestamp, e.powerConfig.ValueSourcePhaseC, @@ -255,8 +262,7 @@ func (e *MPC) UpdateDataPowerPhaseC( nil, nil, ), - Id: *e.acPower[2], - } + ) } // Scenario 2 @@ -271,12 +277,11 @@ func (e *MPC) UpdateDataEnergyConsumed( valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time, -) api.MeasurementDataForID { - if e.acEnergyConsumed == nil { - panic("acEnergyConsumed is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acEnergyConsumed is not supported, please check the configuration", + e.acEnergyConsumed, + measurementData( energyConsumed, timestamp, e.energyConfig.ValueSourceConsumption, @@ -284,8 +289,7 @@ func (e *MPC) UpdateDataEnergyConsumed( evaluationStart, evaluationEnd, ), - Id: *e.acEnergyConsumed, - } + ) } // use MPC.MeasuredUpdateDataEnergyProduced in MPC.Update to set the total feed in energy @@ -298,12 +302,11 @@ func (e *MPC) UpdateDataEnergyProduced( valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time, -) api.MeasurementDataForID { - if e.acEnergyProduced == nil { - panic("acEnergyProduced is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acEnergyProduced is not supported, please check the configuration", + e.acEnergyProduced, + measurementData( energyProduced, timestamp, e.energyConfig.ValueSourceProduction, @@ -311,8 +314,7 @@ func (e *MPC) UpdateDataEnergyProduced( evaluationStart, evaluationEnd, ), - Id: *e.acEnergyProduced, - } + ) } // Scenario 3 @@ -324,12 +326,11 @@ func (e *MPC) UpdateDataCurrentPhaseA( acCurrentPhaseA float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acCurrent[0] == nil { - panic("acCurrentPhaseA is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acCurrentPhaseA is not supported, please check the configuration", + e.acCurrent[0], + measurementData( acCurrentPhaseA, timestamp, e.currentConfig.ValueSourcePhaseA, @@ -337,8 +338,7 @@ func (e *MPC) UpdateDataCurrentPhaseA( nil, nil, ), - Id: *e.acCurrent[0], - } + ) } // use MPC.UpdateDataCurrentPhaseB in MPC.Update to set the momentary phase specific current consumption or production @@ -348,12 +348,11 @@ func (e *MPC) UpdateDataCurrentPhaseB( acCurrentPhaseB float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acCurrent[1] == nil { - panic("acCurrentPhaseB is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acCurrentPhaseB is not supported, please check the configuration", + e.acCurrent[1], + measurementData( acCurrentPhaseB, timestamp, e.currentConfig.ValueSourcePhaseB, @@ -361,8 +360,7 @@ func (e *MPC) UpdateDataCurrentPhaseB( nil, nil, ), - Id: *e.acCurrent[1], - } + ) } // use MPC.UpdateDataCurrentPhaseC in MPC.Update to set the momentary phase specific current consumption or production @@ -372,12 +370,11 @@ func (e *MPC) UpdateDataCurrentPhaseC( acCurrentPhaseC float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acCurrent[2] == nil { - panic("acCurrentPhaseC is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acCurrentPhaseC is not supported, please check the configuration", + e.acCurrent[2], + measurementData( acCurrentPhaseC, timestamp, e.currentConfig.ValueSourcePhaseC, @@ -385,8 +382,7 @@ func (e *MPC) UpdateDataCurrentPhaseC( nil, nil, ), - Id: *e.acCurrent[2], - } + ) } // Scenario 4 @@ -398,12 +394,11 @@ func (e *MPC) UpdateDataVoltagePhaseA( voltagePhaseA float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acVoltage[0] == nil { - panic("acVoltagePhaseA is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acVoltagePhaseA is not supported, please check the configuration", + e.acVoltage[0], + measurementData( voltagePhaseA, timestamp, e.voltageConfig.ValueSourcePhaseA, @@ -411,8 +406,7 @@ func (e *MPC) UpdateDataVoltagePhaseA( nil, nil, ), - Id: *e.acVoltage[0], - } + ) } // use MPC.UpdateDataVoltagePhaseB in MPC.Update to set the phase specific voltage details @@ -422,12 +416,11 @@ func (e *MPC) UpdateDataVoltagePhaseB( voltagePhaseB float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acVoltage[1] == nil { - panic("acVoltagePhaseB is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acVoltagePhaseB is not supported, please check the configuration", + e.acVoltage[1], + measurementData( voltagePhaseB, timestamp, e.voltageConfig.ValueSourcePhaseB, @@ -435,8 +428,7 @@ func (e *MPC) UpdateDataVoltagePhaseB( nil, nil, ), - Id: *e.acVoltage[1], - } + ) } // use MPC.UpdateDataVoltagePhaseC in MPC.Update to set the phase specific voltage details @@ -446,12 +438,11 @@ func (e *MPC) UpdateDataVoltagePhaseC( voltagePhaseC float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acVoltage[2] == nil { - panic("acVoltagePhaseC is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acVoltagePhaseC is not supported, please check the configuration", + e.acVoltage[2], + measurementData( voltagePhaseC, timestamp, e.voltageConfig.ValueSourcePhaseC, @@ -459,8 +450,7 @@ func (e *MPC) UpdateDataVoltagePhaseC( nil, nil, ), - Id: *e.acVoltage[2], - } + ) } // use MPC.UpdateDataVoltagePhaseAToB in MPC.Update to set the phase specific voltage details @@ -470,12 +460,11 @@ func (e *MPC) UpdateDataVoltagePhaseAToB( voltagePhaseAToB float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acVoltage[3] == nil { - panic("acVoltagePhaseAToB is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acVoltagePhaseAToB is not supported, please check the configuration", + e.acVoltage[3], + measurementData( voltagePhaseAToB, timestamp, e.voltageConfig.ValueSourcePhaseAToB, @@ -483,8 +472,7 @@ func (e *MPC) UpdateDataVoltagePhaseAToB( nil, nil, ), - Id: *e.acVoltage[3], - } + ) } // use MPC.UpdateDataVoltagePhaseBToC in MPC.Update to set the phase specific voltage details @@ -494,12 +482,11 @@ func (e *MPC) UpdateDataVoltagePhaseBToC( voltagePhaseBToC float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acVoltage[4] == nil { - panic("acVoltagePhaseBToC is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acVoltagePhaseBToC is not supported, please check the configuration", + e.acVoltage[4], + measurementData( voltagePhaseBToC, timestamp, e.voltageConfig.ValueSourcePhaseBToC, @@ -507,8 +494,7 @@ func (e *MPC) UpdateDataVoltagePhaseBToC( nil, nil, ), - Id: *e.acVoltage[4], - } + ) } // use MPC.UpdateDataVoltagePhaseCToA in MPC.Update to set the phase specific voltage details @@ -518,12 +504,11 @@ func (e *MPC) UpdateDataVoltagePhaseCToA( voltagePhaseCToA float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acVoltage[5] == nil { - panic("acVoltagePhaseCToA is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acVoltagePhaseCToA is not supported, please check the configuration", + e.acVoltage[5], + measurementData( voltagePhaseCToA, timestamp, e.voltageConfig.ValueSourcePhaseCToA, @@ -531,8 +516,7 @@ func (e *MPC) UpdateDataVoltagePhaseCToA( nil, nil, ), - Id: *e.acVoltage[5], - } + ) } // Scenario 5 @@ -544,12 +528,11 @@ func (e *MPC) UpdateDataFrequency( frequency float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) api.MeasurementDataForID { - if e.acFrequency == nil { - panic("acFrequency is not supported, please check the configuration") - } - return api.MeasurementDataForID{ - Data: measurementData( +) usecaseapi.UpdateData { + return newUpdateData( + "acFrequency is not supported, please check the configuration", + e.acFrequency, + measurementData( frequency, timestamp, e.frequencyConfig.ValueSource, @@ -557,6 +540,5 @@ func (e *MPC) UpdateDataFrequency( nil, nil, ), - Id: *e.acFrequency, - } + ) } diff --git a/usecases/mu/mpc/public_bc_test.go b/usecases/mu/mpc/public_bc_test.go index a6a29d5f..93c28904 100644 --- a/usecases/mu/mpc/public_bc_test.go +++ b/usecases/mu/mpc/public_bc_test.go @@ -75,11 +75,10 @@ func (s *MuMpcBcSuite) Test_PowerPerPhase() { assert.Nil(s.T(), err) assert.Equal(s.T(), []float64{6.0, 7.0}, powerPerPhases) - assert.Panics(s.T(), func() { - err = s.sut.Update( - s.sut.UpdateDataPowerPhaseA(5.0, util.Ptr(time.Now()), nil), - ) - }) + err = s.sut.Update( + s.sut.UpdateDataPowerPhaseA(5.0, util.Ptr(time.Now()), nil), + ) + assert.NotNil(s.T(), err) } func (s *MuMpcBcSuite) Test_EnergyConsumed() { @@ -115,11 +114,10 @@ func (s *MuMpcBcSuite) Test_CurrentPerPhase() { assert.Nil(s.T(), err) assert.Equal(s.T(), []float64{3.0, 1.0}, currentPerPhases) - assert.Panics(s.T(), func() { - err = s.sut.Update( - s.sut.UpdateDataCurrentPhaseA(5.0, nil, nil), - ) - }) + err = s.sut.Update( + s.sut.UpdateDataCurrentPhaseA(5.0, nil, nil), + ) + assert.NotNil(s.T(), err) } func (s *MuMpcBcSuite) Test_VoltagePerPhase() { @@ -134,23 +132,20 @@ func (s *MuMpcBcSuite) Test_VoltagePerPhase() { assert.Nil(s.T(), err) assert.Equal(s.T(), []float64{6.0, 7.0, 9.0}, voltagePerPhases) - assert.Panics(s.T(), func() { - _ = s.sut.Update( - s.sut.UpdateDataVoltagePhaseA(5.0, nil, nil), - ) - }) - - assert.Panics(s.T(), func() { - _ = s.sut.Update( - s.sut.UpdateDataVoltagePhaseAToB(8.0, nil, nil), - ) - }) - - assert.Panics(s.T(), func() { - _ = s.sut.Update( - s.sut.UpdateDataVoltagePhaseCToA(10.0, nil, nil), - ) - }) + err = s.sut.Update( + s.sut.UpdateDataVoltagePhaseA(5.0, nil, nil), + ) + assert.NotNil(s.T(), err) + + err = s.sut.Update( + s.sut.UpdateDataVoltagePhaseAToB(5.0, nil, nil), + ) + assert.NotNil(s.T(), err) + + err = s.sut.Update( + s.sut.UpdateDataVoltagePhaseCToA(5.0, nil, nil), + ) + assert.NotNil(s.T(), err) } func (s *MuMpcBcSuite) Test_Frequency() { diff --git a/usecases/mu/mpc/update_helper.go b/usecases/mu/mpc/update_helper.go new file mode 100644 index 00000000..279f03bc --- /dev/null +++ b/usecases/mu/mpc/update_helper.go @@ -0,0 +1,77 @@ +package mpc + +import ( + "errors" + "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" + "time" +) + +type UpdateData struct { + supported bool + notSupportedError error + measurementData api.MeasurementDataForID +} + +func (u *UpdateData) Supported() bool { + return u.supported +} + +func (u *UpdateData) NotSupportedError() error { + return u.notSupportedError +} + +func (u *UpdateData) MeasurementData() api.MeasurementDataForID { + return u.measurementData +} + +func newUpdateData( + errorString string, + id *model.MeasurementIdType, + data *model.MeasurementDataType, +) *UpdateData { + if id == nil || data == nil { + return &UpdateData{ + supported: false, + notSupportedError: errors.New(errorString), + } + } else { + return &UpdateData{ + supported: true, + measurementData: api.MeasurementDataForID{ + Id: *id, + Data: *data, + }, + } + } +} + +func measurementData( + value float64, + timestamp *time.Time, + valueSource *model.MeasurementValueSourceType, + valueState *model.MeasurementValueStateType, + evaluationStart *time.Time, + evaluationEnd *time.Time, +) *model.MeasurementDataType { + measurement := model.MeasurementDataType{ + ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), + Value: model.NewScaledNumberType(value), + ValueSource: valueSource, + ValueState: valueState, + } + + if timestamp != nil { + measurement.Timestamp = model.NewAbsoluteOrRelativeTimeTypeFromTime(*timestamp) + } + + if evaluationStart != nil && evaluationEnd != nil { + measurement.EvaluationPeriod = &model.TimePeriodType{ + StartTime: model.NewAbsoluteOrRelativeTimeTypeFromTime(*evaluationStart), + EndTime: model.NewAbsoluteOrRelativeTimeTypeFromTime(*evaluationEnd), + } + } + + return &measurement +} diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index 7ae35d79..d206ecb1 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -2,8 +2,6 @@ package mpc import ( "errors" - "time" - "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" "github.com/enbility/eebus-go/usecases/usecase" @@ -535,35 +533,6 @@ func (e *MPC) getMeasurementDataForId(id *model.MeasurementIdType) (float64, err return data.Value.GetValue(), nil } -func measurementData( - value float64, - timestamp *time.Time, - valueSource *model.MeasurementValueSourceType, - valueState *model.MeasurementValueStateType, - evaluationStart *time.Time, - evaluationEnd *time.Time, -) model.MeasurementDataType { - measurement := model.MeasurementDataType{ - ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), - Value: model.NewScaledNumberType(value), - ValueSource: valueSource, - ValueState: valueState, - } - - if timestamp != nil { - measurement.Timestamp = model.NewAbsoluteOrRelativeTimeTypeFromTime(*timestamp) - } - - if evaluationStart != nil && evaluationEnd != nil { - measurement.EvaluationPeriod = &model.TimePeriodType{ - StartTime: model.NewAbsoluteOrRelativeTimeTypeFromTime(*evaluationStart), - EndTime: model.NewAbsoluteOrRelativeTimeTypeFromTime(*evaluationEnd), - } - } - - return measurement -} - var phases = [][]string{ {"a"}, {"b"}, From 6d40163ceda3be11ce3e05215f27e4e8e7bdb904 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Fri, 22 Nov 2024 11:15:37 +0100 Subject: [PATCH 12/61] little fixes --- usecases/mu/mpc/testhelper_test.go | 32 +++--------------------------- usecases/mu/mpc/usecase.go | 6 +++--- 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/usecases/mu/mpc/testhelper_test.go b/usecases/mu/mpc/testhelper_test.go index 2d975a95..c3bb7cc6 100644 --- a/usecases/mu/mpc/testhelper_test.go +++ b/usecases/mu/mpc/testhelper_test.go @@ -9,7 +9,6 @@ import ( shipapi "github.com/enbility/ship-go/api" "github.com/enbility/ship-go/cert" spineapi "github.com/enbility/spine-go/api" - spinemocks "github.com/enbility/spine-go/mocks" "github.com/enbility/spine-go/model" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" @@ -28,15 +27,6 @@ type MuMPCSuite struct { sut *MPC service api.ServiceInterface - - remoteDevice spineapi.DeviceRemoteInterface - mockRemoteEntity *spinemocks.EntityRemoteInterface - monitoredEntity spineapi.EntityRemoteInterface - loadControlFeature, - deviceDiagnosisFeature, - deviceConfigurationFeature spineapi.FeatureLocalInterface - - eventCalled bool } func NewMuMPCSuite( @@ -57,12 +47,10 @@ func NewMuMPCSuite( } } -func (s *MuMPCSuite) Event(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event api.EventType) { - s.eventCalled = true +func (s *MuMPCSuite) Event(_ string, _ spineapi.DeviceRemoteInterface, _ spineapi.EntityRemoteInterface, _ api.EventType) { } -func (s *MuMPCSuite) BeforeTest(suiteName, testName string) { - s.eventCalled = false +func (s *MuMPCSuite) BeforeTest(_, _ string) { cert, _ := cert.CreateCertificate("test", "test", "DE", "test") configuration, _ := api.NewConfiguration( "test", "test", "test", "test", @@ -77,19 +65,6 @@ func (s *MuMPCSuite) BeforeTest(suiteName, testName string) { s.service = service.NewService(configuration, serviceHandler) _ = s.service.Setup() - mockRemoteDevice := spinemocks.NewDeviceRemoteInterface(s.T()) - s.mockRemoteEntity = spinemocks.NewEntityRemoteInterface(s.T()) - mockRemoteFeature := spinemocks.NewFeatureRemoteInterface(s.T()) - mockRemoteDevice.EXPECT().FeatureByEntityTypeAndRole(mock.Anything, mock.Anything, mock.Anything).Return(mockRemoteFeature).Maybe() - mockRemoteDevice.EXPECT().Ski().Return(remoteSki).Maybe() - s.mockRemoteEntity.EXPECT().Device().Return(mockRemoteDevice).Maybe() - s.mockRemoteEntity.EXPECT().EntityType().Return(mock.Anything).Maybe() - entityAddress := &model.EntityAddressType{} - s.mockRemoteEntity.EXPECT().Address().Return(entityAddress).Maybe() - mockRemoteFeature.EXPECT().DataCopy(mock.Anything).Return(mock.Anything).Maybe() - mockRemoteFeature.EXPECT().Address().Return(&model.FeatureAddressType{}).Maybe() - mockRemoteFeature.EXPECT().Operations().Return(nil).Maybe() - localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) s.sut, _ = NewMPC( localEntity, @@ -100,8 +75,7 @@ func (s *MuMPCSuite) BeforeTest(suiteName, testName string) { s.voltageConfig, s.frequencyConfig, ) + s.sut.AddFeatures() s.sut.AddUseCase() - - //s.remoteDevice, s.monitoredEntity = setupDevices(s.service, s.T()) } diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index d206ecb1..703fcb4f 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -141,9 +141,9 @@ func NewMPC( func (e *MPC) AddFeatures() { // server features - electricalConnectionFeatrue := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) - electricalConnectionFeatrue.AddFunctionType(model.FunctionTypeElectricalConnectionDescriptionListData, true, false) - electricalConnectionFeatrue.AddFunctionType(model.FunctionTypeElectricalConnectionParameterDescriptionListData, true, false) + electricalConnectionFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) + electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionDescriptionListData, true, false) + electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionParameterDescriptionListData, true, false) measurementFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) measurementFeature.AddFunctionType(model.FunctionTypeMeasurementDescriptionListData, true, false) From b80232bbc2bd656951a785b4af432001299bf1b9 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Fri, 22 Nov 2024 11:16:25 +0100 Subject: [PATCH 13/61] Test if the client-filters work with the data set by the server. --- usecases/mu/mpc/public_abc_test.go | 81 ++++++++++++++++++++++++++++++ usecases/mu/mpc/public_bc_test.go | 21 ++++++++ usecases/mu/mpc/testhelper_test.go | 64 +++++++++++++++++++++++ 3 files changed, 166 insertions(+) diff --git a/usecases/mu/mpc/public_abc_test.go b/usecases/mu/mpc/public_abc_test.go index a4d30f8a..dc1cc3e1 100644 --- a/usecases/mu/mpc/public_abc_test.go +++ b/usecases/mu/mpc/public_abc_test.go @@ -1,6 +1,8 @@ package mpc import ( + "github.com/enbility/eebus-go/features/server" + ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/util" "github.com/stretchr/testify/assert" @@ -67,6 +69,16 @@ func (s *MuMpcAbcSuite) Test_Power() { power, err := s.sut.Power() assert.Nil(s.T(), err) assert.Equal(s.T(), 5.0, power) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, nil) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0}, values) } func (s *MuMpcAbcSuite) Test_PowerPerPhase() { @@ -80,6 +92,16 @@ func (s *MuMpcAbcSuite) Test_PowerPerPhase() { powerPerPhases, err := s.sut.PowerPerPhase() assert.Nil(s.T(), err) assert.Equal(s.T(), []float64{5.0, 6.0, 7.0}, powerPerPhases) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACPower), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 6.0, 7.0}, values) } func (s *MuMpcAbcSuite) Test_EnergyConsumed() { @@ -91,6 +113,19 @@ func (s *MuMpcAbcSuite) Test_EnergyConsumed() { energyConsumed, err := s.sut.EnergyConsumed() assert.Nil(s.T(), err) assert.Equal(s.T(), 5.0, energyConsumed) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), + } + measurement, err := server.NewMeasurement(s.sut.LocalEntity) + assert.Nil(s.T(), err) + values, err := measurement.GetDataForFilter(filter) + assert.Nil(s.T(), err) + assert.Equal(s.T(), 1, len(values)) + assert.Equal(s.T(), 5.0, (*values[0].Value).GetValue()) } func (s *MuMpcAbcSuite) Test_EnergyProduced() { @@ -102,6 +137,19 @@ func (s *MuMpcAbcSuite) Test_EnergyProduced() { energyProduced, err := s.sut.EnergyProduced() assert.Nil(s.T(), err) assert.Equal(s.T(), 5.0, energyProduced) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), + } + measurement, err := server.NewMeasurement(s.sut.LocalEntity) + assert.Nil(s.T(), err) + values, err := measurement.GetDataForFilter(filter) + assert.Nil(s.T(), err) + assert.Equal(s.T(), 1, len(values)) + assert.Equal(s.T(), 5.0, (*values[0].Value).GetValue()) } func (s *MuMpcAbcSuite) Test_CurrentPerPhase() { @@ -115,6 +163,16 @@ func (s *MuMpcAbcSuite) Test_CurrentPerPhase() { currentPerPhases, err := s.sut.CurrentPerPhase() assert.Nil(s.T(), err) assert.Equal(s.T(), []float64{5.0, 3.0, 1.0}, currentPerPhases) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 3.0, 1.0}, values) } func (s *MuMpcAbcSuite) Test_VoltagePerPhase() { @@ -131,6 +189,16 @@ func (s *MuMpcAbcSuite) Test_VoltagePerPhase() { voltagePerPhases, err := s.sut.VoltagePerPhase() assert.Nil(s.T(), err) assert.Equal(s.T(), []float64{5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, voltagePerPhases) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, "", ucapi.PhaseNameMapping) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, values) } func (s *MuMpcAbcSuite) Test_Frequency() { @@ -142,4 +210,17 @@ func (s *MuMpcAbcSuite) Test_Frequency() { frequency, err := s.sut.Frequency() assert.Nil(s.T(), err) assert.Equal(s.T(), 5.0, frequency) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), + } + measurements, err := server.NewMeasurement(s.sut.LocalEntity) + assert.Nil(s.T(), err) + values, err := measurements.GetDataForFilter(filter) + assert.Nil(s.T(), err) + assert.Equal(s.T(), 1, len(values)) + assert.Equal(s.T(), 5.0, (*values[0].Value).GetValue()) } diff --git a/usecases/mu/mpc/public_bc_test.go b/usecases/mu/mpc/public_bc_test.go index 93c28904..cbefdc5b 100644 --- a/usecases/mu/mpc/public_bc_test.go +++ b/usecases/mu/mpc/public_bc_test.go @@ -1,6 +1,7 @@ package mpc import ( + ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/util" "github.com/stretchr/testify/assert" @@ -79,6 +80,16 @@ func (s *MuMpcBcSuite) Test_PowerPerPhase() { s.sut.UpdateDataPowerPhaseA(5.0, util.Ptr(time.Now()), nil), ) assert.NotNil(s.T(), err) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACPower), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{6.0, 7.0}, values) } func (s *MuMpcBcSuite) Test_EnergyConsumed() { @@ -146,6 +157,16 @@ func (s *MuMpcBcSuite) Test_VoltagePerPhase() { s.sut.UpdateDataVoltagePhaseCToA(5.0, nil, nil), ) assert.NotNil(s.T(), err) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, "", ucapi.PhaseNameMapping) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{6.0, 7.0, 9.0}, values) } func (s *MuMpcBcSuite) Test_Frequency() { diff --git a/usecases/mu/mpc/testhelper_test.go b/usecases/mu/mpc/testhelper_test.go index c3bb7cc6..b7ff0e4a 100644 --- a/usecases/mu/mpc/testhelper_test.go +++ b/usecases/mu/mpc/testhelper_test.go @@ -1,6 +1,8 @@ package mpc import ( + "github.com/enbility/eebus-go/features/server" + "slices" "time" "github.com/enbility/eebus-go/api" @@ -79,3 +81,65 @@ func (s *MuMPCSuite) BeforeTest(_, _ string) { s.sut.AddFeatures() s.sut.AddUseCase() } + +func (s *MuMPCSuite) measurementPhaseSpecificDataForFilter( + measurementFilter model.MeasurementDescriptionDataType, + energyDirection model.EnergyDirectionType, + validPhaseNameTypes []model.ElectricalConnectionPhaseNameType, +) ([]float64, error) { + measurements, err := server.NewMeasurement(s.sut.LocalEntity) + if err != nil { + return nil, err + } + + electricalConnection, err := server.NewElectricalConnection(s.sut.LocalEntity) + if err != nil { + return nil, err + } + + data, err := measurements.GetDataForFilter(measurementFilter) + if err != nil || len(data) == 0 { + return nil, api.ErrDataNotAvailable + } + + var result []float64 + + for _, item := range data { + if item.Value == nil || item.MeasurementId == nil { + continue + } + + if validPhaseNameTypes != nil { + filter := model.ElectricalConnectionParameterDescriptionDataType{ + MeasurementId: item.MeasurementId, + } + param, err := electricalConnection.GetParameterDescriptionsForFilter(filter) + if err != nil || len(param) == 0 || + param[0].AcMeasuredPhases == nil || + !slices.Contains(validPhaseNameTypes, *param[0].AcMeasuredPhases) { + continue + } + } + + if energyDirection != "" { + filter := model.ElectricalConnectionParameterDescriptionDataType{ + MeasurementId: item.MeasurementId, + } + desc, err := electricalConnection.GetDescriptionForParameterDescriptionFilter(filter) + if err != nil || desc == nil { + continue + } + + // if energy direction is not consume + if desc.PositiveEnergyDirection == nil || *desc.PositiveEnergyDirection != energyDirection { + return nil, err + } + } + + value := item.Value.GetValue() + + result = append(result, value) + } + + return result, nil +} From 2482104122d4096589300dddbf3d98069d550f5a Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Fri, 22 Nov 2024 14:53:55 +0100 Subject: [PATCH 14/61] Let the AddFeatures method return an error --- api/api.go | 2 +- api/usecases.go | 2 +- examples/ced/main.go | 10 +++++-- examples/controlbox/main.go | 10 +++++-- examples/evse/main.go | 5 +++- examples/hems/main.go | 41 +++++++++++++++++++++----- examples/remote/ucs.go | 6 +++- service/service.go | 9 ++++-- usecases/cem/cevc/testhelper_test.go | 2 +- usecases/cem/cevc/usecase.go | 4 ++- usecases/cem/evcc/usecase.go | 4 ++- usecases/cem/evcem/testhelper_test.go | 2 +- usecases/cem/evcem/usecase.go | 4 ++- usecases/cem/evsecc/testhelper_test.go | 2 +- usecases/cem/evsecc/usecase.go | 4 ++- usecases/cem/evsoc/testhelper_test.go | 2 +- usecases/cem/evsoc/usecase.go | 4 ++- usecases/cem/opev/testhelper_test.go | 2 +- usecases/cem/opev/usecase.go | 4 ++- usecases/cem/oscev/testhelper_test.go | 2 +- usecases/cem/oscev/usecase.go | 4 ++- usecases/cem/vabd/testhelper_test.go | 2 +- usecases/cem/vabd/usecase.go | 4 ++- usecases/cem/vapd/testhelper_test.go | 2 +- usecases/cem/vapd/usecase.go | 4 ++- usecases/cs/lpc/testhelper_test.go | 2 +- usecases/cs/lpc/usecase.go | 25 +++++++++++++--- usecases/cs/lpp/testhelper_test.go | 2 +- usecases/cs/lpp/usecase.go | 30 +++++++++++++++---- usecases/eg/lpc/usecase.go | 4 ++- usecases/eg/lpp/testhelper_test.go | 2 +- usecases/eg/lpp/usecase.go | 4 ++- usecases/ma/mgcp/testhelper_test.go | 2 +- usecases/ma/mgcp/usecase.go | 4 ++- usecases/ma/mpc/testhelper_test.go | 2 +- usecases/ma/mpc/usecase.go | 4 ++- usecases/mu/mpc/testhelper_test.go | 2 +- usecases/mu/mpc/usecase.go | 12 ++++---- usecases/mu/mpc/usecase_test.go | 3 +- 39 files changed, 176 insertions(+), 59 deletions(-) diff --git a/api/api.go b/api/api.go index 1dc14a7c..d429e592 100644 --- a/api/api.go +++ b/api/api.go @@ -32,7 +32,7 @@ type ServiceInterface interface { IsRunning() bool // add a use case to the service - AddUseCase(useCase UseCaseInterface) + AddUseCase(useCase UseCaseInterface) error // set logging interface SetLogging(logger logging.LoggingInterface) diff --git a/api/usecases.go b/api/usecases.go index bb120ee7..b5660055 100644 --- a/api/usecases.go +++ b/api/usecases.go @@ -57,5 +57,5 @@ type UseCaseInterface interface { UseCaseBaseInterface // add the features - AddFeatures() + AddFeatures() error } diff --git a/examples/ced/main.go b/examples/ced/main.go index 1d2e1014..4aecdde4 100644 --- a/examples/ced/main.go +++ b/examples/ced/main.go @@ -126,12 +126,18 @@ func (h *controlbox) run() { localEntity := h.myService.LocalDevice().EntityForType(model.EntityTypeTypeHeatPumpAppliance) h.uclpc = lpc.NewLPC(localEntity, h.OnLPCEvent) - h.myService.AddUseCase(h.uclpc) + err = h.myService.AddUseCase(h.uclpc) + if err != nil { + log.Fatal(err) + } // h.uclpp = lpp.NewLPP(localEntity, h.OnLPPEvent) // h.myService.AddUseCase(h.uclpp) h.ucmpc = mpc.NewMPC(localEntity, h.OnMPCEvent) - h.myService.AddUseCase(h.ucmpc) + err = h.myService.AddUseCase(h.ucmpc) + if err != nil { + log.Fatal(err) + } if len(config.remoteSKI) == 0 && pairingConfig == nil { os.Exit(0) diff --git a/examples/controlbox/main.go b/examples/controlbox/main.go index 53344a3b..cfc8c304 100644 --- a/examples/controlbox/main.go +++ b/examples/controlbox/main.go @@ -189,10 +189,16 @@ func (h *controlbox) run() { localEntity := h.myService.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard) h.uclpc = lpc.NewLPC(localEntity, h.OnLPCEvent) - h.myService.AddUseCase(h.uclpc) + err = h.myService.AddUseCase(h.uclpc) + if err != nil { + log.Fatal(err) + } h.uclpp = lpp.NewLPP(localEntity, h.OnLPPEvent) - h.myService.AddUseCase(h.uclpp) + err = h.myService.AddUseCase(h.uclpp) + if err != nil { + log.Fatal(err) + } for _, remoteSki := range config.remoteSKIs { h.myService.RegisterRemoteService(shipapi.NewServiceIdentity(remoteSki, "", "")) diff --git a/examples/evse/main.go b/examples/evse/main.go index e2278628..718c09f2 100644 --- a/examples/evse/main.go +++ b/examples/evse/main.go @@ -119,7 +119,10 @@ func (h *evse) run() { localEntity := h.myService.LocalDevice().EntityForType(model.EntityTypeTypeEVSE) h.uclpc = lpc.NewLPC(localEntity, h.OnLPCEvent) - h.myService.AddUseCase(h.uclpc) + err = h.myService.AddUseCase(h.uclpc) + if err != nil { + log.Fatal(err) + } // Initialize local server data _ = h.uclpc.SetConsumptionNominalMax(32000) diff --git a/examples/hems/main.go b/examples/hems/main.go index cfabe83f..4063aa59 100644 --- a/examples/hems/main.go +++ b/examples/hems/main.go @@ -129,19 +129,46 @@ func (h *hems) run() { localEntity := h.myService.LocalDevice().EntityForType(model.EntityTypeTypeCEM) h.uccslpc = cslpc.NewLPC(localEntity, h.OnLPCEvent) - h.myService.AddUseCase(h.uccslpc) + err = h.myService.AddUseCase(h.uccslpc) + if err != nil { + log.Fatal(err) + } + h.uccslpp = cslpp.NewLPP(localEntity, h.OnLPPEvent) - h.myService.AddUseCase(h.uccslpp) + err = h.myService.AddUseCase(h.uccslpp) + if err != nil { + log.Fatal(err) + } + h.uceglpc = eglpc.NewLPC(localEntity, nil) - h.myService.AddUseCase(h.uceglpc) + err = h.myService.AddUseCase(h.uceglpc) + if err != nil { + log.Fatal(err) + } + h.uceglpp = eglpp.NewLPP(localEntity, nil) - h.myService.AddUseCase(h.uceglpp) + err = h.myService.AddUseCase(h.uceglpp) + if err != nil { + log.Fatal(err) + } + h.ucmamgcp = mgcp.NewMGCP(localEntity, h.OnMGCPEvent) - h.myService.AddUseCase(h.ucmamgcp) + err = h.myService.AddUseCase(h.ucmamgcp) + if err != nil { + log.Fatal(err) + } + h.uccemvabd = vabd.NewVABD(localEntity, h.OnVABDEvent) - h.myService.AddUseCase(h.uccemvabd) + err = h.myService.AddUseCase(h.uccemvabd) + if err != nil { + log.Fatal(err) + } + h.uccemvapd = vapd.NewVAPD(localEntity, h.OnVAPDEvent) - h.myService.AddUseCase(h.uccemvapd) + err = h.myService.AddUseCase(h.uccemvapd) + if err != nil { + log.Fatal(err) + } // Initialize local server data _ = h.uccslpc.SetConsumptionNominalMax(32000) diff --git a/examples/remote/ucs.go b/examples/remote/ucs.go index 457963a2..1adb2b66 100644 --- a/examples/remote/ucs.go +++ b/examples/remote/ucs.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "log" "github.com/enbility/eebus-go/api" spineapi "github.com/enbility/spine-go/api" @@ -31,7 +32,10 @@ func (r *Remote) RegisterUseCase(entityType model.EntityTypeType, usecaseId stri ) { r.PropagateEvent(identifier, ski, device, entity, event) }) - r.service.AddUseCase(uc) + err := r.service.AddUseCase(uc) + if err != nil { + log.Fatal(err) + } return r.registerStaticReceiverProxy(usecaseId, uc) } diff --git a/service/service.go b/service/service.go index 27904413..d1722d11 100644 --- a/service/service.go +++ b/service/service.go @@ -205,11 +205,16 @@ func (s *Service) IsRunning() bool { } // add a use case to the service -func (s *Service) AddUseCase(useCase api.UseCaseInterface) { +func (s *Service) AddUseCase(useCase api.UseCaseInterface) error { s.usecases = append(s.usecases, useCase) - useCase.AddFeatures() + err := useCase.AddFeatures() + if err != nil { + return err + } useCase.AddUseCase() + + return nil } func (s *Service) Configuration() *api.Configuration { diff --git a/usecases/cem/cevc/testhelper_test.go b/usecases/cem/cevc/testhelper_test.go index 2ff55e74..52c365c3 100644 --- a/usecases/cem/cevc/testhelper_test.go +++ b/usecases/cem/cevc/testhelper_test.go @@ -75,7 +75,7 @@ func (s *CemCEVCSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewCEVC(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() var entities []spineapi.EntityRemoteInterface diff --git a/usecases/cem/cevc/usecase.go b/usecases/cem/cevc/usecase.go index 96ef2e1e..b5c88682 100644 --- a/usecases/cem/cevc/usecase.go +++ b/usecases/cem/cevc/usecase.go @@ -81,7 +81,7 @@ func NewCEVC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC return uc } -func (e *CEVC) AddFeatures() { +func (e *CEVC) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeDeviceConfiguration, @@ -97,4 +97,6 @@ func (e *CEVC) AddFeatures() { f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeServer) f.AddFunctionType(model.FunctionTypeDeviceDiagnosisStateData, true, false) f.AddFunctionType(model.FunctionTypeDeviceDiagnosisHeartbeatData, true, false) + + return nil } diff --git a/usecases/cem/evcc/usecase.go b/usecases/cem/evcc/usecase.go index c34588c0..89f1c874 100644 --- a/usecases/cem/evcc/usecase.go +++ b/usecases/cem/evcc/usecase.go @@ -95,7 +95,7 @@ func NewEVCC( return uc } -func (e *EVCC) AddFeatures() { +func (e *EVCC) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeDeviceConfiguration, @@ -108,4 +108,6 @@ func (e *EVCC) AddFeatures() { f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) f.AddResultCallback(e.HandleResponse) } + + return nil } diff --git a/usecases/cem/evcem/testhelper_test.go b/usecases/cem/evcem/testhelper_test.go index c1d43c55..86043980 100644 --- a/usecases/cem/evcem/testhelper_test.go +++ b/usecases/cem/evcem/testhelper_test.go @@ -70,7 +70,7 @@ func (s *CemEVCEMSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewEVCEM(s.service, localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() var entities []spineapi.EntityRemoteInterface diff --git a/usecases/cem/evcem/usecase.go b/usecases/cem/evcem/usecase.go index 93f42ef3..9d42ed48 100644 --- a/usecases/cem/evcem/usecase.go +++ b/usecases/cem/evcem/usecase.go @@ -82,7 +82,7 @@ func NewEVCEM( return uc } -func (e *EVCEM) AddFeatures() { +func (e *EVCEM) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeElectricalConnection, @@ -91,4 +91,6 @@ func (e *EVCEM) AddFeatures() { for _, feature := range clientFeatures { _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) } + + return nil } diff --git a/usecases/cem/evsecc/testhelper_test.go b/usecases/cem/evsecc/testhelper_test.go index 4ab305a5..4927b9f1 100644 --- a/usecases/cem/evsecc/testhelper_test.go +++ b/usecases/cem/evsecc/testhelper_test.go @@ -73,7 +73,7 @@ func (s *CemEVSECCSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewEVSECC(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() var entities []spineapi.EntityRemoteInterface diff --git a/usecases/cem/evsecc/usecase.go b/usecases/cem/evsecc/usecase.go index 8c4f054c..9e459ce1 100644 --- a/usecases/cem/evsecc/usecase.go +++ b/usecases/cem/evsecc/usecase.go @@ -63,7 +63,7 @@ func NewEVSECC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEven return uc } -func (e *EVSECC) AddFeatures() { +func (e *EVSECC) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeDeviceClassification, @@ -73,4 +73,6 @@ func (e *EVSECC) AddFeatures() { for _, feature := range clientFeatures { _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) } + + return nil } diff --git a/usecases/cem/evsoc/testhelper_test.go b/usecases/cem/evsoc/testhelper_test.go index 8ce937d7..495de203 100644 --- a/usecases/cem/evsoc/testhelper_test.go +++ b/usecases/cem/evsoc/testhelper_test.go @@ -73,7 +73,7 @@ func (s *CemEVSOCSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewEVSOC(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() var entities []spineapi.EntityRemoteInterface diff --git a/usecases/cem/evsoc/usecase.go b/usecases/cem/evsoc/usecase.go index 0d11a174..3c9b73b8 100644 --- a/usecases/cem/evsoc/usecase.go +++ b/usecases/cem/evsoc/usecase.go @@ -58,7 +58,7 @@ func NewEVSOC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEvent return uc } -func (e *EVSOC) AddFeatures() { +func (e *EVSOC) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeElectricalConnection, @@ -67,6 +67,8 @@ func (e *EVSOC) AddFeatures() { for _, feature := range clientFeatures { _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) } + + return nil } func (e *EVSOC) UpdateUseCaseAvailability(available bool) { diff --git a/usecases/cem/opev/testhelper_test.go b/usecases/cem/opev/testhelper_test.go index 67c19a79..3efa29ff 100644 --- a/usecases/cem/opev/testhelper_test.go +++ b/usecases/cem/opev/testhelper_test.go @@ -73,7 +73,7 @@ func (s *CemOPEVSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewOPEV(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() var clientFeatures = []model.FeatureTypeType{ diff --git a/usecases/cem/opev/usecase.go b/usecases/cem/opev/usecase.go index d60dd7cc..1e06abb5 100644 --- a/usecases/cem/opev/usecase.go +++ b/usecases/cem/opev/usecase.go @@ -69,7 +69,7 @@ func NewOPEV(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC return uc } -func (e *OPEV) AddFeatures() { +func (e *OPEV) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeLoadControl, @@ -83,4 +83,6 @@ func (e *OPEV) AddFeatures() { f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeServer) f.AddFunctionType(model.FunctionTypeDeviceDiagnosisStateData, true, false) f.AddFunctionType(model.FunctionTypeDeviceDiagnosisHeartbeatData, true, false) + + return nil } diff --git a/usecases/cem/oscev/testhelper_test.go b/usecases/cem/oscev/testhelper_test.go index a771abc8..b2924b1f 100644 --- a/usecases/cem/oscev/testhelper_test.go +++ b/usecases/cem/oscev/testhelper_test.go @@ -72,7 +72,7 @@ func (s *CemOSCEVSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewOSCEV(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() var clientFeatures = []model.FeatureTypeType{ diff --git a/usecases/cem/oscev/usecase.go b/usecases/cem/oscev/usecase.go index a8b44a76..0aa2ba08 100644 --- a/usecases/cem/oscev/usecase.go +++ b/usecases/cem/oscev/usecase.go @@ -69,7 +69,7 @@ func NewOSCEV(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEvent return uc } -func (e *OSCEV) AddFeatures() { +func (e *OSCEV) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeLoadControl, @@ -83,4 +83,6 @@ func (e *OSCEV) AddFeatures() { f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeServer) f.AddFunctionType(model.FunctionTypeDeviceDiagnosisStateData, true, false) f.AddFunctionType(model.FunctionTypeDeviceDiagnosisHeartbeatData, true, false) + + return nil } diff --git a/usecases/cem/vabd/testhelper_test.go b/usecases/cem/vabd/testhelper_test.go index 7f39eba1..ff0a6eb9 100644 --- a/usecases/cem/vabd/testhelper_test.go +++ b/usecases/cem/vabd/testhelper_test.go @@ -73,7 +73,7 @@ func (s *CemVABDSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewVABD(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() s.remoteDevice, s.batteryEntity = setupDevices(s.service, s.T()) diff --git a/usecases/cem/vabd/usecase.go b/usecases/cem/vabd/usecase.go index edb8fd9a..2fd4e022 100644 --- a/usecases/cem/vabd/usecase.go +++ b/usecases/cem/vabd/usecase.go @@ -83,7 +83,7 @@ func NewVABD(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC return uc } -func (e *VABD) AddFeatures() { +func (e *VABD) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeDeviceConfiguration, @@ -93,4 +93,6 @@ func (e *VABD) AddFeatures() { for _, feature := range clientFeatures { _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) } + + return nil } diff --git a/usecases/cem/vapd/testhelper_test.go b/usecases/cem/vapd/testhelper_test.go index cc05e217..380612ec 100644 --- a/usecases/cem/vapd/testhelper_test.go +++ b/usecases/cem/vapd/testhelper_test.go @@ -73,7 +73,7 @@ func (s *CemVAPDSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewVAPD(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() s.remoteDevice, s.pvEntity = setupDevices(s.service, s.T()) diff --git a/usecases/cem/vapd/usecase.go b/usecases/cem/vapd/usecase.go index 4780a4df..6cae541c 100644 --- a/usecases/cem/vapd/usecase.go +++ b/usecases/cem/vapd/usecase.go @@ -74,7 +74,7 @@ func NewVAPD(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC return uc } -func (e *VAPD) AddFeatures() { +func (e *VAPD) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeDeviceConfiguration, @@ -84,4 +84,6 @@ func (e *VAPD) AddFeatures() { for _, feature := range clientFeatures { _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) } + + return nil } diff --git a/usecases/cs/lpc/testhelper_test.go b/usecases/cs/lpc/testhelper_test.go index c155de57..25b3059b 100644 --- a/usecases/cs/lpc/testhelper_test.go +++ b/usecases/cs/lpc/testhelper_test.go @@ -76,7 +76,7 @@ func (s *CsLPCSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewLPC(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() s.loadControlFeature = localEntity.FeatureOfTypeAndRole(model.FeatureTypeTypeLoadControl, model.RoleTypeServer) diff --git a/usecases/cs/lpc/usecase.go b/usecases/cs/lpc/usecase.go index 959590c2..612588f9 100644 --- a/usecases/cs/lpc/usecase.go +++ b/usecases/cs/lpc/usecase.go @@ -226,7 +226,7 @@ func (e *LPC) deviceConfigurationWriteCB(msg *spineapi.Message) { go e.approveOrDenyDeviceConfiguration(msg, true, "") } -func (e *LPC) AddFeatures() { +func (e *LPC) AddFeatures() error { // client features _ = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeClient) @@ -234,7 +234,10 @@ func (e *LPC) AddFeatures() { f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeLoadControl, model.RoleTypeServer) f.AddFunctionType(model.FunctionTypeLoadControlLimitDescriptionListData, true, false) f.AddFunctionType(model.FunctionTypeLoadControlLimitListData, true, true) - _ = f.AddWriteApprovalCallback(e.loadControlWriteCB) + err := f.AddWriteApprovalCallback(e.loadControlWriteCB) + if err != nil { + return err + } measurementId := internal.GetPowerTotalMeasurementId(e.LocalEntity) newLimitDesc := model.LoadControlLimitDescriptionDataType{ @@ -259,6 +262,8 @@ func (e *LPC) AddFeatures() { }, } _ = lc.UpdateLimitDataForIds(newLimiData) + } else { + return err } f = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceConfiguration, model.RoleTypeServer) @@ -291,7 +296,7 @@ func (e *LPC) AddFeatures() { value := &model.DeviceConfigurationKeyValueValueType{ ScaledNumber: model.NewScaledNumberType(0), } - _ = dcs.UpdateKeyValueDataForFilter( + err1 := dcs.UpdateKeyValueDataForFilter( model.DeviceConfigurationKeyValueDataType{ Value: value, IsValueChangeable: util.Ptr(true), @@ -301,11 +306,14 @@ func (e *LPC) AddFeatures() { KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeConsumptionActivePowerLimit), }, ) + if err1 != nil { + return err1 + } value = &model.DeviceConfigurationKeyValueValueType{ Duration: model.NewDurationType(0), } - _ = dcs.UpdateKeyValueDataForFilter( + err1 = dcs.UpdateKeyValueDataForFilter( model.DeviceConfigurationKeyValueDataType{ Value: value, IsValueChangeable: util.Ptr(true), @@ -315,6 +323,11 @@ func (e *LPC) AddFeatures() { KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), }, ) + if err1 != nil { + return err1 + } + } else { + return err } f = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeServer) @@ -334,5 +347,9 @@ func (e *LPC) AddFeatures() { Unit: util.Ptr(model.UnitOfMeasurementTypeW), } _, _ = ec.AddCharacteristic(newCharData) + } else { + return err } + + return nil } diff --git a/usecases/cs/lpp/testhelper_test.go b/usecases/cs/lpp/testhelper_test.go index 539c5c9a..6292b311 100644 --- a/usecases/cs/lpp/testhelper_test.go +++ b/usecases/cs/lpp/testhelper_test.go @@ -76,7 +76,7 @@ func (s *CsLPPSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewLPP(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() s.loadControlFeature = localEntity.FeatureOfTypeAndRole(model.FeatureTypeTypeLoadControl, model.RoleTypeServer) diff --git a/usecases/cs/lpp/usecase.go b/usecases/cs/lpp/usecase.go index aeb79898..24d9005c 100644 --- a/usecases/cs/lpp/usecase.go +++ b/usecases/cs/lpp/usecase.go @@ -226,7 +226,7 @@ func (e *LPP) deviceConfigurationWriteCB(msg *spineapi.Message) { go e.approveOrDenyDeviceConfiguration(msg, true, "") } -func (e *LPP) AddFeatures() { +func (e *LPP) AddFeatures() error { // client features _ = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeClient) @@ -234,7 +234,10 @@ func (e *LPP) AddFeatures() { f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeLoadControl, model.RoleTypeServer) f.AddFunctionType(model.FunctionTypeLoadControlLimitDescriptionListData, true, false) f.AddFunctionType(model.FunctionTypeLoadControlLimitListData, true, true) - _ = f.AddWriteApprovalCallback(e.loadControlWriteCB) + err := f.AddWriteApprovalCallback(e.loadControlWriteCB) + if err != nil { + return err + } measurementId := internal.GetPowerTotalMeasurementId(e.LocalEntity) newLimitDesc := model.LoadControlLimitDescriptionDataType{ @@ -259,6 +262,8 @@ func (e *LPP) AddFeatures() { }, } _ = lc.UpdateLimitDataForIds(newLimiData) + } else { + return err } f = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceConfiguration, model.RoleTypeServer) @@ -291,7 +296,7 @@ func (e *LPP) AddFeatures() { value := &model.DeviceConfigurationKeyValueValueType{ ScaledNumber: model.NewScaledNumberType(0), } - _ = dcs.UpdateKeyValueDataForFilter( + err1 := dcs.UpdateKeyValueDataForFilter( model.DeviceConfigurationKeyValueDataType{ Value: value, IsValueChangeable: util.Ptr(true), @@ -301,11 +306,14 @@ func (e *LPP) AddFeatures() { KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeProductionActivePowerLimit), }, ) + if err1 != nil { + return err1 + } value = &model.DeviceConfigurationKeyValueValueType{ Duration: model.NewDurationType(0), } - _ = dcs.UpdateKeyValueDataForFilter( + err1 = dcs.UpdateKeyValueDataForFilter( model.DeviceConfigurationKeyValueDataType{ Value: value, IsValueChangeable: util.Ptr(true), @@ -315,6 +323,11 @@ func (e *LPP) AddFeatures() { KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), }, ) + if err1 != nil { + return err1 + } + } else { + return err } f = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeServer) @@ -333,6 +346,13 @@ func (e *LPP) AddFeatures() { CharacteristicType: util.Ptr(e.characteristicType()), Unit: util.Ptr(model.UnitOfMeasurementTypeW), } - _, _ = ec.AddCharacteristic(newCharData) + _, err1 := ec.AddCharacteristic(newCharData) + if err1 != nil { + return err1 + } + } else { + return err } + + return nil } diff --git a/usecases/eg/lpc/usecase.go b/usecases/eg/lpc/usecase.go index 1885003d..bec522fc 100644 --- a/usecases/eg/lpc/usecase.go +++ b/usecases/eg/lpc/usecase.go @@ -77,7 +77,7 @@ func NewLPC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCa return uc } -func (e *LPC) AddFeatures() { +func (e *LPC) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeDeviceDiagnosis, @@ -92,4 +92,6 @@ func (e *LPC) AddFeatures() { // server features f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeServer) f.AddFunctionType(model.FunctionTypeDeviceDiagnosisHeartbeatData, true, false) + + return nil } diff --git a/usecases/eg/lpp/testhelper_test.go b/usecases/eg/lpp/testhelper_test.go index 0b083652..e7fda5d2 100644 --- a/usecases/eg/lpp/testhelper_test.go +++ b/usecases/eg/lpp/testhelper_test.go @@ -73,7 +73,7 @@ func (s *EgLPPSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewLPP(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() s.remoteDevice, s.monitoredEntity = setupDevices(s.service, s.T()) diff --git a/usecases/eg/lpp/usecase.go b/usecases/eg/lpp/usecase.go index 34710332..368f871c 100644 --- a/usecases/eg/lpp/usecase.go +++ b/usecases/eg/lpp/usecase.go @@ -75,7 +75,7 @@ func NewLPP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCa return uc } -func (e *LPP) AddFeatures() { +func (e *LPP) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeDeviceDiagnosis, @@ -90,6 +90,8 @@ func (e *LPP) AddFeatures() { // server features f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeServer) f.AddFunctionType(model.FunctionTypeDeviceDiagnosisHeartbeatData, true, false) + + return nil } func (e *LPP) UpdateUseCaseAvailability(available bool) { diff --git a/usecases/ma/mgcp/testhelper_test.go b/usecases/ma/mgcp/testhelper_test.go index 83fb2f85..452250fa 100644 --- a/usecases/ma/mgcp/testhelper_test.go +++ b/usecases/ma/mgcp/testhelper_test.go @@ -73,7 +73,7 @@ func (s *GcpMGCPSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewMGCP(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() s.remoteDevice, s.smgwEntity = setupDevices(s.service, s.T()) diff --git a/usecases/ma/mgcp/usecase.go b/usecases/ma/mgcp/usecase.go index 0b9ae005..5d3c97fb 100644 --- a/usecases/ma/mgcp/usecase.go +++ b/usecases/ma/mgcp/usecase.go @@ -105,7 +105,7 @@ func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC return uc } -func (e *MGCP) AddFeatures() { +func (e *MGCP) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeDeviceConfiguration, @@ -115,4 +115,6 @@ func (e *MGCP) AddFeatures() { for _, feature := range clientFeatures { _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) } + + return nil } diff --git a/usecases/ma/mpc/testhelper_test.go b/usecases/ma/mpc/testhelper_test.go index 1cdc9cf5..0f1a6458 100644 --- a/usecases/ma/mpc/testhelper_test.go +++ b/usecases/ma/mpc/testhelper_test.go @@ -73,7 +73,7 @@ func (s *MaMPCSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewMPC(localEntity, s.Event) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() s.remoteDevice, s.monitoredEntity = setupDevices(s.service, s.T()) diff --git a/usecases/ma/mpc/usecase.go b/usecases/ma/mpc/usecase.go index baa3ecb5..ff3917b2 100644 --- a/usecases/ma/mpc/usecase.go +++ b/usecases/ma/mpc/usecase.go @@ -97,7 +97,7 @@ func NewMPC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCa return uc } -func (e *MPC) AddFeatures() { +func (e *MPC) AddFeatures() error { // client features var clientFeatures = []model.FeatureTypeType{ model.FeatureTypeTypeElectricalConnection, @@ -106,4 +106,6 @@ func (e *MPC) AddFeatures() { for _, feature := range clientFeatures { _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) } + + return nil } diff --git a/usecases/mu/mpc/testhelper_test.go b/usecases/mu/mpc/testhelper_test.go index b7ff0e4a..f0def4a9 100644 --- a/usecases/mu/mpc/testhelper_test.go +++ b/usecases/mu/mpc/testhelper_test.go @@ -78,7 +78,7 @@ func (s *MuMPCSuite) BeforeTest(_, _ string) { s.frequencyConfig, ) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() } diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index 703fcb4f..0c53514c 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -139,7 +139,7 @@ func NewMPC( return uc, nil } -func (e *MPC) AddFeatures() { +func (e *MPC) AddFeatures() error { // server features electricalConnectionFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionDescriptionListData, true, false) @@ -152,12 +152,12 @@ func (e *MPC) AddFeatures() { measurements, err := server.NewMeasurement(e.LocalEntity) if err != nil { - // TODO fix AddFeatures()? + return err } electricalConnection, err := server.NewElectricalConnection(e.LocalEntity) if err != nil { - // TODO fix AddFeatures()? + return err } electricalConnectionId := model.ElectricalConnectionIdType(0) @@ -169,7 +169,7 @@ func (e *MPC) AddFeatures() { } if err := electricalConnection.AddDescription(electricalConnectionDescription); err != nil { - // TODO return error + return err } constraints := make([]model.MeasurementConstraintsDataType, 0) @@ -189,7 +189,7 @@ func (e *MPC) AddFeatures() { for _, configMethod := range configMethods { if err := configMethod(measurements, electricalConnection, &electricalConnectionId, &constraints); err != nil { - // TODO return error + return err } } @@ -201,6 +201,8 @@ func (e *MPC) AddFeatures() { }, nil, nil, ) } + + return nil } func (e *MPC) configureMonitorPower( diff --git a/usecases/mu/mpc/usecase_test.go b/usecases/mu/mpc/usecase_test.go index af42d9f2..fb7404f3 100644 --- a/usecases/mu/mpc/usecase_test.go +++ b/usecases/mu/mpc/usecase_test.go @@ -145,7 +145,8 @@ func (s *BasicSuite) Test_MpcOptionalParameters() { assert.Nil(s.T(), err) - mpc.AddFeatures() + err = mpc.AddFeatures() + assert.Nil(s.T(), err) mpc.AddUseCase() } } From 67cbbf1004e6d6c023b3b67d77ee20697a2598f8 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 27 Nov 2024 09:49:59 +0100 Subject: [PATCH 15/61] Add a function in the electrical connection to get or add a ElectricalConnectionId for a specific ElectricalConnectionDescription --- features/server/electricalconnection.go | 42 ++++++++++++++++++++ features/server/electricalconnection_test.go | 34 ++++++++++++++++ usecases/mu/mpc/usecase.go | 30 ++++++-------- 3 files changed, 89 insertions(+), 17 deletions(-) diff --git a/features/server/electricalconnection.go b/features/server/electricalconnection.go index 39bef0a7..8cb84c2a 100644 --- a/features/server/electricalconnection.go +++ b/features/server/electricalconnection.go @@ -31,6 +31,48 @@ func NewElectricalConnection(localEntity spineapi.EntityLocalInterface) (*Electr return ec, nil } +func (e *ElectricalConnection) GetOrAddIdForDescription( + electricalConnectionDescription model.ElectricalConnectionDescriptionDataType, +) (*model.ElectricalConnectionIdType, error) { + electricalConnectionId := (*model.ElectricalConnectionIdType)(nil) + highestExistingElectricalConnectionId := model.ElectricalConnectionIdType(0) + + descriptionData := e.featureLocal.DataCopy(model.FunctionTypeElectricalConnectionDescriptionListData).(*model.ElectricalConnectionDescriptionListDataType) + + if descriptionData != nil && descriptionData.ElectricalConnectionDescriptionData != nil { + for _, description := range descriptionData.ElectricalConnectionDescriptionData { + if description.ElectricalConnectionId != nil && + description.PowerSupplyType == electricalConnectionDescription.PowerSupplyType && + description.AcConnectedPhases == electricalConnectionDescription.AcConnectedPhases && + description.AcRmsPeriodDuration == electricalConnectionDescription.AcRmsPeriodDuration && + description.PositiveEnergyDirection == electricalConnectionDescription.PositiveEnergyDirection && + description.ScopeType == electricalConnectionDescription.ScopeType && + description.Label == electricalConnectionDescription.Label && + description.Description == electricalConnectionDescription.Description { + electricalConnectionId = description.ElectricalConnectionId + break + } else if description.ElectricalConnectionId != nil { + if *description.ElectricalConnectionId > highestExistingElectricalConnectionId { + highestExistingElectricalConnectionId = *description.ElectricalConnectionId + } + } + } + } + + if electricalConnectionId == nil { + electricalConnectionId = util.Ptr(highestExistingElectricalConnectionId + 1) + description := electricalConnectionDescription + description.ElectricalConnectionId = electricalConnectionId + if errType := e.featureLocal.UpdateData(model.FunctionTypeElectricalConnectionDescriptionListData, &model.ElectricalConnectionDescriptionListDataType{ + ElectricalConnectionDescriptionData: []model.ElectricalConnectionDescriptionDataType{description}, + }, model.NewFilterTypePartial(), nil); errType != nil { + return nil, errors.New("could not add description data") + } + } + + return electricalConnectionId, nil +} + // Add a new description data set // // NOTE: the electricalConnectionId has to be provided diff --git a/features/server/electricalconnection_test.go b/features/server/electricalconnection_test.go index bb8187cc..8f6fd1df 100644 --- a/features/server/electricalconnection_test.go +++ b/features/server/electricalconnection_test.go @@ -119,6 +119,40 @@ func (s *ElectricalConnectionSuite) Test_Description() { assert.NotNil(s.T(), data) } +func (s *ElectricalConnectionSuite) Test_GetOrAddIdForDescription() { + filter := model.ElectricalConnectionDescriptionDataType{} + + data, err := s.sut.GetDescriptionsForFilter(filter) + assert.NotNil(s.T(), err) + assert.Nil(s.T(), data) + + desc1 := model.ElectricalConnectionDescriptionDataType{ + PowerSupplyType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeDc), + ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), + } + + eConnectionId, err := s.sut.GetOrAddIdForDescription(desc1) + assert.Nil(s.T(), err) + assert.Equal(s.T(), model.ElectricalConnectionIdType(1), *eConnectionId) + + eConnectionId, err = s.sut.GetOrAddIdForDescription(desc1) + assert.Nil(s.T(), err) + assert.Equal(s.T(), model.ElectricalConnectionIdType(1), *eConnectionId) + + desc2 := model.ElectricalConnectionDescriptionDataType{ + PowerSupplyType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), + } + + eConnectionId2, err := s.sut.GetOrAddIdForDescription(desc2) + assert.Nil(s.T(), err) + assert.Equal(s.T(), model.ElectricalConnectionIdType(2), *eConnectionId2) + + eConnectionId, err = s.sut.GetOrAddIdForDescription(desc1) + assert.Nil(s.T(), err) + assert.Equal(s.T(), model.ElectricalConnectionIdType(1), *eConnectionId) +} + func (s *ElectricalConnectionSuite) Test_ParameterDescription() { filter := model.ElectricalConnectionParameterDescriptionDataType{} diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index 0c53514c..1a0e11b4 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -160,15 +160,11 @@ func (e *MPC) AddFeatures() error { return err } - electricalConnectionId := model.ElectricalConnectionIdType(0) - - electricalConnectionDescription := model.ElectricalConnectionDescriptionDataType{ - ElectricalConnectionId: &electricalConnectionId, + electricalConnectionId, err := electricalConnection.GetOrAddIdForDescription(model.ElectricalConnectionDescriptionDataType{ PowerSupplyType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), PositiveEnergyDirection: util.Ptr(model.EnergyDirectionTypeConsume), - } - - if err := electricalConnection.AddDescription(electricalConnectionDescription); err != nil { + }) + if err != nil { return err } @@ -188,7 +184,7 @@ func (e *MPC) AddFeatures() error { } for _, configMethod := range configMethods { - if err := configMethod(measurements, electricalConnection, &electricalConnectionId, &constraints); err != nil { + if err := configMethod(measurements, electricalConnection, electricalConnectionId, &constraints); err != nil { return err } } @@ -212,7 +208,7 @@ func (e *MPC) configureMonitorPower( measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { if e.powerConfig == nil { - return nil // TODO return error if not optional + return errors.New("mpc monitoring power must be configured") } e.acPowerTotal = measurements.AddDescription(model.MeasurementDescriptionDataType{ @@ -239,7 +235,7 @@ func (e *MPC) configureMonitorPower( parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) if parameterDescriptionId == nil { - // TODO return error + return errors.New("could not add parameter description") } acPowerConstraints := []*model.MeasurementConstraintsDataType{ @@ -280,7 +276,7 @@ func (e *MPC) configureMonitorPower( parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) if parameterDescriptionId == nil { - // TODO return error + return errors.New("could not add parameter description") } } } @@ -319,7 +315,7 @@ func (e *MPC) configureMonitorEnergy( parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) if parameterDescriptionId == nil { - // TODO return error + return errors.New("could not add parameter description") } } @@ -344,7 +340,7 @@ func (e *MPC) configureMonitorEnergy( } idP4 := electricalConnection.AddParameterDescription(p4) if idP4 == nil { - // TODO return error + return errors.New("could not add parameter description") } } @@ -358,7 +354,7 @@ func (e *MPC) configureMonitorCurrent( measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { if e.currentConfig == nil { - return nil // TODO? + return nil } acCurrentConstraints := []*model.MeasurementConstraintsDataType{ @@ -398,7 +394,7 @@ func (e *MPC) configureMonitorCurrent( parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) if parameterDescriptionId == nil { - // TODO return error + return errors.New("could not add parameter description") } } } @@ -473,7 +469,7 @@ func (e *MPC) configureMonitorVoltage( parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) if parameterDescriptionId == nil { - // TODO return error + return errors.New("could not add parameter description") } } } @@ -511,7 +507,7 @@ func (e *MPC) configureMonitorFrequency( parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) if parameterDescriptionId == nil { - // TODO return error + return errors.New("could not add parameter description") } return nil From 0011953748b40422dc232aef2a5df2fa9005634c Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Fri, 29 Nov 2024 10:55:48 +0100 Subject: [PATCH 16/61] Update mocks and fix service_test --- mocks/EntityEventCallback.go | 2 +- mocks/ServiceInterface.go | 25 +- mocks/UseCaseInterface.go | 25 +- service/service_test.go | 2 +- usecases/mocks/CemCEVCInterface.go | 25 +- usecases/mocks/CemEVCCInterface.go | 25 +- usecases/mocks/CemEVCEMInterface.go | 25 +- usecases/mocks/CemEVSECCInterface.go | 25 +- usecases/mocks/CemEVSOCInterface.go | 25 +- usecases/mocks/CemOPEVInterface.go | 25 +- usecases/mocks/CemOSCEVInterface.go | 25 +- usecases/mocks/CemVABDInterface.go | 25 +- usecases/mocks/CemVAPDInterface.go | 25 +- usecases/mocks/CsLPCInterface.go | 25 +- usecases/mocks/CsLPPInterface.go | 25 +- usecases/mocks/EgLPCInterface.go | 25 +- usecases/mocks/EgLPPInterface.go | 25 +- usecases/mocks/MaMGCPInterface.go | 25 +- usecases/mocks/MaMPCInterface.go | 25 +- usecases/mocks/MuMPCInterface.go | 1541 ++++++++++++++++++++++++++ usecases/mocks/UpdateData.go | 169 +++ 21 files changed, 2018 insertions(+), 121 deletions(-) create mode 100644 usecases/mocks/MuMPCInterface.go create mode 100644 usecases/mocks/UpdateData.go diff --git a/mocks/EntityEventCallback.go b/mocks/EntityEventCallback.go index 042ca199..c1b5b914 100644 --- a/mocks/EntityEventCallback.go +++ b/mocks/EntityEventCallback.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. +// Code generated by mockery v2.46.3. DO NOT EDIT. package mocks diff --git a/mocks/ServiceInterface.go b/mocks/ServiceInterface.go index 05dd00e5..3b0f3a7e 100644 --- a/mocks/ServiceInterface.go +++ b/mocks/ServiceInterface.go @@ -40,9 +40,20 @@ func (_m *ServiceInterface) EXPECT() *ServiceInterface_Expecter { } // AddUseCase provides a mock function for the type ServiceInterface -func (_mock *ServiceInterface) AddUseCase(useCase api.UseCaseInterface) { - _mock.Called(useCase) - return +func (_mock *ServiceInterface) AddUseCase(useCase api.UseCaseInterface) error { + ret := _mock.Called(useCase) + + if len(ret) == 0 { + panic("no return value specified for AddUseCase") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(api.UseCaseInterface) error); ok { + r0 = returnFunc(useCase) + } else { + r0 = ret.Error(0) + } + return r0 } // ServiceInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -69,13 +80,13 @@ func (_c *ServiceInterface_AddUseCase_Call) Run(run func(useCase api.UseCaseInte return _c } -func (_c *ServiceInterface_AddUseCase_Call) Return() *ServiceInterface_AddUseCase_Call { - _c.Call.Return() +func (_c *ServiceInterface_AddUseCase_Call) Return(err error) *ServiceInterface_AddUseCase_Call { + _c.Call.Return(err) return _c } -func (_c *ServiceInterface_AddUseCase_Call) RunAndReturn(run func(useCase api.UseCaseInterface)) *ServiceInterface_AddUseCase_Call { - _c.Run(run) +func (_c *ServiceInterface_AddUseCase_Call) RunAndReturn(run func(useCase api.UseCaseInterface) error) *ServiceInterface_AddUseCase_Call { + _c.Call.Return(run) return _c } diff --git a/mocks/UseCaseInterface.go b/mocks/UseCaseInterface.go index 31081cf3..308ef381 100644 --- a/mocks/UseCaseInterface.go +++ b/mocks/UseCaseInterface.go @@ -38,9 +38,20 @@ func (_m *UseCaseInterface) EXPECT() *UseCaseInterface_Expecter { } // AddFeatures provides a mock function for the type UseCaseInterface -func (_mock *UseCaseInterface) AddFeatures() { - _mock.Called() - return +func (_mock *UseCaseInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // UseCaseInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -60,13 +71,13 @@ func (_c *UseCaseInterface_AddFeatures_Call) Run(run func()) *UseCaseInterface_A return _c } -func (_c *UseCaseInterface_AddFeatures_Call) Return() *UseCaseInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *UseCaseInterface_AddFeatures_Call) Return(err error) *UseCaseInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *UseCaseInterface_AddFeatures_Call) RunAndReturn(run func()) *UseCaseInterface_AddFeatures_Call { - _c.Run(run) +func (_c *UseCaseInterface_AddFeatures_Call) RunAndReturn(run func() error) *UseCaseInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/service/service_test.go b/service/service_test.go index 122f5a43..9edd6b58 100644 --- a/service/service_test.go +++ b/service/service_test.go @@ -64,7 +64,7 @@ func (s *ServiceSuite) BeforeTest(suiteName, testName string) { func (s *ServiceSuite) Test_AddUseCase() { ucMock := mocks.NewUseCaseInterface(s.T()) - ucMock.EXPECT().AddFeatures().Return().Once() + ucMock.EXPECT().AddFeatures().Return(nil).Once() ucMock.EXPECT().AddUseCase().Return().Once() s.sut.AddUseCase(ucMock) diff --git a/usecases/mocks/CemCEVCInterface.go b/usecases/mocks/CemCEVCInterface.go index bb8393ba..b317cfa0 100644 --- a/usecases/mocks/CemCEVCInterface.go +++ b/usecases/mocks/CemCEVCInterface.go @@ -39,9 +39,20 @@ func (_m *CemCEVCInterface) EXPECT() *CemCEVCInterface_Expecter { } // AddFeatures provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) AddFeatures() { - _mock.Called() - return +func (_mock *CemCEVCInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // CemCEVCInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -61,13 +72,13 @@ func (_c *CemCEVCInterface_AddFeatures_Call) Run(run func()) *CemCEVCInterface_A return _c } -func (_c *CemCEVCInterface_AddFeatures_Call) Return() *CemCEVCInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *CemCEVCInterface_AddFeatures_Call) Return(err error) *CemCEVCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *CemCEVCInterface_AddFeatures_Call) RunAndReturn(run func()) *CemCEVCInterface_AddFeatures_Call { - _c.Run(run) +func (_c *CemCEVCInterface_AddFeatures_Call) RunAndReturn(run func() error) *CemCEVCInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/CemEVCCInterface.go b/usecases/mocks/CemEVCCInterface.go index 5b474d2a..a6ec3e4f 100644 --- a/usecases/mocks/CemEVCCInterface.go +++ b/usecases/mocks/CemEVCCInterface.go @@ -40,9 +40,20 @@ func (_m *CemEVCCInterface) EXPECT() *CemEVCCInterface_Expecter { } // AddFeatures provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) AddFeatures() { - _mock.Called() - return +func (_mock *CemEVCCInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // CemEVCCInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -62,13 +73,13 @@ func (_c *CemEVCCInterface_AddFeatures_Call) Run(run func()) *CemEVCCInterface_A return _c } -func (_c *CemEVCCInterface_AddFeatures_Call) Return() *CemEVCCInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *CemEVCCInterface_AddFeatures_Call) Return(err error) *CemEVCCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *CemEVCCInterface_AddFeatures_Call) RunAndReturn(run func()) *CemEVCCInterface_AddFeatures_Call { - _c.Run(run) +func (_c *CemEVCCInterface_AddFeatures_Call) RunAndReturn(run func() error) *CemEVCCInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/CemEVCEMInterface.go b/usecases/mocks/CemEVCEMInterface.go index 02310eed..ad688652 100644 --- a/usecases/mocks/CemEVCEMInterface.go +++ b/usecases/mocks/CemEVCEMInterface.go @@ -38,9 +38,20 @@ func (_m *CemEVCEMInterface) EXPECT() *CemEVCEMInterface_Expecter { } // AddFeatures provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) AddFeatures() { - _mock.Called() - return +func (_mock *CemEVCEMInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // CemEVCEMInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -60,13 +71,13 @@ func (_c *CemEVCEMInterface_AddFeatures_Call) Run(run func()) *CemEVCEMInterface return _c } -func (_c *CemEVCEMInterface_AddFeatures_Call) Return() *CemEVCEMInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *CemEVCEMInterface_AddFeatures_Call) Return(err error) *CemEVCEMInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *CemEVCEMInterface_AddFeatures_Call) RunAndReturn(run func()) *CemEVCEMInterface_AddFeatures_Call { - _c.Run(run) +func (_c *CemEVCEMInterface_AddFeatures_Call) RunAndReturn(run func() error) *CemEVCEMInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/CemEVSECCInterface.go b/usecases/mocks/CemEVSECCInterface.go index 1c2c018c..239d37be 100644 --- a/usecases/mocks/CemEVSECCInterface.go +++ b/usecases/mocks/CemEVSECCInterface.go @@ -40,9 +40,20 @@ func (_m *CemEVSECCInterface) EXPECT() *CemEVSECCInterface_Expecter { } // AddFeatures provides a mock function for the type CemEVSECCInterface -func (_mock *CemEVSECCInterface) AddFeatures() { - _mock.Called() - return +func (_mock *CemEVSECCInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // CemEVSECCInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -62,13 +73,13 @@ func (_c *CemEVSECCInterface_AddFeatures_Call) Run(run func()) *CemEVSECCInterfa return _c } -func (_c *CemEVSECCInterface_AddFeatures_Call) Return() *CemEVSECCInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *CemEVSECCInterface_AddFeatures_Call) Return(err error) *CemEVSECCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *CemEVSECCInterface_AddFeatures_Call) RunAndReturn(run func()) *CemEVSECCInterface_AddFeatures_Call { - _c.Run(run) +func (_c *CemEVSECCInterface_AddFeatures_Call) RunAndReturn(run func() error) *CemEVSECCInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/CemEVSOCInterface.go b/usecases/mocks/CemEVSOCInterface.go index 862e8563..d3c7e0ac 100644 --- a/usecases/mocks/CemEVSOCInterface.go +++ b/usecases/mocks/CemEVSOCInterface.go @@ -38,9 +38,20 @@ func (_m *CemEVSOCInterface) EXPECT() *CemEVSOCInterface_Expecter { } // AddFeatures provides a mock function for the type CemEVSOCInterface -func (_mock *CemEVSOCInterface) AddFeatures() { - _mock.Called() - return +func (_mock *CemEVSOCInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // CemEVSOCInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -60,13 +71,13 @@ func (_c *CemEVSOCInterface_AddFeatures_Call) Run(run func()) *CemEVSOCInterface return _c } -func (_c *CemEVSOCInterface_AddFeatures_Call) Return() *CemEVSOCInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *CemEVSOCInterface_AddFeatures_Call) Return(err error) *CemEVSOCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *CemEVSOCInterface_AddFeatures_Call) RunAndReturn(run func()) *CemEVSOCInterface_AddFeatures_Call { - _c.Run(run) +func (_c *CemEVSOCInterface_AddFeatures_Call) RunAndReturn(run func() error) *CemEVSOCInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/CemOPEVInterface.go b/usecases/mocks/CemOPEVInterface.go index 70eb72b3..6e4ae1fd 100644 --- a/usecases/mocks/CemOPEVInterface.go +++ b/usecases/mocks/CemOPEVInterface.go @@ -40,9 +40,20 @@ func (_m *CemOPEVInterface) EXPECT() *CemOPEVInterface_Expecter { } // AddFeatures provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) AddFeatures() { - _mock.Called() - return +func (_mock *CemOPEVInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // CemOPEVInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -62,13 +73,13 @@ func (_c *CemOPEVInterface_AddFeatures_Call) Run(run func()) *CemOPEVInterface_A return _c } -func (_c *CemOPEVInterface_AddFeatures_Call) Return() *CemOPEVInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *CemOPEVInterface_AddFeatures_Call) Return(err error) *CemOPEVInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *CemOPEVInterface_AddFeatures_Call) RunAndReturn(run func()) *CemOPEVInterface_AddFeatures_Call { - _c.Run(run) +func (_c *CemOPEVInterface_AddFeatures_Call) RunAndReturn(run func() error) *CemOPEVInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/CemOSCEVInterface.go b/usecases/mocks/CemOSCEVInterface.go index 0f11ef40..15abdbd2 100644 --- a/usecases/mocks/CemOSCEVInterface.go +++ b/usecases/mocks/CemOSCEVInterface.go @@ -40,9 +40,20 @@ func (_m *CemOSCEVInterface) EXPECT() *CemOSCEVInterface_Expecter { } // AddFeatures provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) AddFeatures() { - _mock.Called() - return +func (_mock *CemOSCEVInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // CemOSCEVInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -62,13 +73,13 @@ func (_c *CemOSCEVInterface_AddFeatures_Call) Run(run func()) *CemOSCEVInterface return _c } -func (_c *CemOSCEVInterface_AddFeatures_Call) Return() *CemOSCEVInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *CemOSCEVInterface_AddFeatures_Call) Return(err error) *CemOSCEVInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *CemOSCEVInterface_AddFeatures_Call) RunAndReturn(run func()) *CemOSCEVInterface_AddFeatures_Call { - _c.Run(run) +func (_c *CemOSCEVInterface_AddFeatures_Call) RunAndReturn(run func() error) *CemOSCEVInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/CemVABDInterface.go b/usecases/mocks/CemVABDInterface.go index 00360d58..0d14200a 100644 --- a/usecases/mocks/CemVABDInterface.go +++ b/usecases/mocks/CemVABDInterface.go @@ -38,9 +38,20 @@ func (_m *CemVABDInterface) EXPECT() *CemVABDInterface_Expecter { } // AddFeatures provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) AddFeatures() { - _mock.Called() - return +func (_mock *CemVABDInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // CemVABDInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -60,13 +71,13 @@ func (_c *CemVABDInterface_AddFeatures_Call) Run(run func()) *CemVABDInterface_A return _c } -func (_c *CemVABDInterface_AddFeatures_Call) Return() *CemVABDInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *CemVABDInterface_AddFeatures_Call) Return(err error) *CemVABDInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *CemVABDInterface_AddFeatures_Call) RunAndReturn(run func()) *CemVABDInterface_AddFeatures_Call { - _c.Run(run) +func (_c *CemVABDInterface_AddFeatures_Call) RunAndReturn(run func() error) *CemVABDInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/CemVAPDInterface.go b/usecases/mocks/CemVAPDInterface.go index b751d207..a9b2d65d 100644 --- a/usecases/mocks/CemVAPDInterface.go +++ b/usecases/mocks/CemVAPDInterface.go @@ -38,9 +38,20 @@ func (_m *CemVAPDInterface) EXPECT() *CemVAPDInterface_Expecter { } // AddFeatures provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) AddFeatures() { - _mock.Called() - return +func (_mock *CemVAPDInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // CemVAPDInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -60,13 +71,13 @@ func (_c *CemVAPDInterface_AddFeatures_Call) Run(run func()) *CemVAPDInterface_A return _c } -func (_c *CemVAPDInterface_AddFeatures_Call) Return() *CemVAPDInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *CemVAPDInterface_AddFeatures_Call) Return(err error) *CemVAPDInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *CemVAPDInterface_AddFeatures_Call) RunAndReturn(run func()) *CemVAPDInterface_AddFeatures_Call { - _c.Run(run) +func (_c *CemVAPDInterface_AddFeatures_Call) RunAndReturn(run func() error) *CemVAPDInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/CsLPCInterface.go b/usecases/mocks/CsLPCInterface.go index fcbbde21..f65c21fd 100644 --- a/usecases/mocks/CsLPCInterface.go +++ b/usecases/mocks/CsLPCInterface.go @@ -42,9 +42,20 @@ func (_m *CsLPCInterface) EXPECT() *CsLPCInterface_Expecter { } // AddFeatures provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) AddFeatures() { - _mock.Called() - return +func (_mock *CsLPCInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // CsLPCInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -64,13 +75,13 @@ func (_c *CsLPCInterface_AddFeatures_Call) Run(run func()) *CsLPCInterface_AddFe return _c } -func (_c *CsLPCInterface_AddFeatures_Call) Return() *CsLPCInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *CsLPCInterface_AddFeatures_Call) Return(err error) *CsLPCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *CsLPCInterface_AddFeatures_Call) RunAndReturn(run func()) *CsLPCInterface_AddFeatures_Call { - _c.Run(run) +func (_c *CsLPCInterface_AddFeatures_Call) RunAndReturn(run func() error) *CsLPCInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/CsLPPInterface.go b/usecases/mocks/CsLPPInterface.go index 3d6d6ed8..1d759382 100644 --- a/usecases/mocks/CsLPPInterface.go +++ b/usecases/mocks/CsLPPInterface.go @@ -42,9 +42,20 @@ func (_m *CsLPPInterface) EXPECT() *CsLPPInterface_Expecter { } // AddFeatures provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) AddFeatures() { - _mock.Called() - return +func (_mock *CsLPPInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // CsLPPInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -64,13 +75,13 @@ func (_c *CsLPPInterface_AddFeatures_Call) Run(run func()) *CsLPPInterface_AddFe return _c } -func (_c *CsLPPInterface_AddFeatures_Call) Return() *CsLPPInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *CsLPPInterface_AddFeatures_Call) Return(err error) *CsLPPInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *CsLPPInterface_AddFeatures_Call) RunAndReturn(run func()) *CsLPPInterface_AddFeatures_Call { - _c.Run(run) +func (_c *CsLPPInterface_AddFeatures_Call) RunAndReturn(run func() error) *CsLPPInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/EgLPCInterface.go b/usecases/mocks/EgLPCInterface.go index aba2463b..f88e5516 100644 --- a/usecases/mocks/EgLPCInterface.go +++ b/usecases/mocks/EgLPCInterface.go @@ -42,9 +42,20 @@ func (_m *EgLPCInterface) EXPECT() *EgLPCInterface_Expecter { } // AddFeatures provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) AddFeatures() { - _mock.Called() - return +func (_mock *EgLPCInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // EgLPCInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -64,13 +75,13 @@ func (_c *EgLPCInterface_AddFeatures_Call) Run(run func()) *EgLPCInterface_AddFe return _c } -func (_c *EgLPCInterface_AddFeatures_Call) Return() *EgLPCInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *EgLPCInterface_AddFeatures_Call) Return(err error) *EgLPCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *EgLPCInterface_AddFeatures_Call) RunAndReturn(run func()) *EgLPCInterface_AddFeatures_Call { - _c.Run(run) +func (_c *EgLPCInterface_AddFeatures_Call) RunAndReturn(run func() error) *EgLPCInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/EgLPPInterface.go b/usecases/mocks/EgLPPInterface.go index 70f83792..d6fdc86a 100644 --- a/usecases/mocks/EgLPPInterface.go +++ b/usecases/mocks/EgLPPInterface.go @@ -42,9 +42,20 @@ func (_m *EgLPPInterface) EXPECT() *EgLPPInterface_Expecter { } // AddFeatures provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) AddFeatures() { - _mock.Called() - return +func (_mock *EgLPPInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // EgLPPInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -64,13 +75,13 @@ func (_c *EgLPPInterface_AddFeatures_Call) Run(run func()) *EgLPPInterface_AddFe return _c } -func (_c *EgLPPInterface_AddFeatures_Call) Return() *EgLPPInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *EgLPPInterface_AddFeatures_Call) Return(err error) *EgLPPInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *EgLPPInterface_AddFeatures_Call) RunAndReturn(run func()) *EgLPPInterface_AddFeatures_Call { - _c.Run(run) +func (_c *EgLPPInterface_AddFeatures_Call) RunAndReturn(run func() error) *EgLPPInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/MaMGCPInterface.go b/usecases/mocks/MaMGCPInterface.go index 9287260e..e2e93db1 100644 --- a/usecases/mocks/MaMGCPInterface.go +++ b/usecases/mocks/MaMGCPInterface.go @@ -38,9 +38,20 @@ func (_m *MaMGCPInterface) EXPECT() *MaMGCPInterface_Expecter { } // AddFeatures provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) AddFeatures() { - _mock.Called() - return +func (_mock *MaMGCPInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // MaMGCPInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -60,13 +71,13 @@ func (_c *MaMGCPInterface_AddFeatures_Call) Run(run func()) *MaMGCPInterface_Add return _c } -func (_c *MaMGCPInterface_AddFeatures_Call) Return() *MaMGCPInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *MaMGCPInterface_AddFeatures_Call) Return(err error) *MaMGCPInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *MaMGCPInterface_AddFeatures_Call) RunAndReturn(run func()) *MaMGCPInterface_AddFeatures_Call { - _c.Run(run) +func (_c *MaMGCPInterface_AddFeatures_Call) RunAndReturn(run func() error) *MaMGCPInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/MaMPCInterface.go b/usecases/mocks/MaMPCInterface.go index 02b55cc3..840ae2f4 100644 --- a/usecases/mocks/MaMPCInterface.go +++ b/usecases/mocks/MaMPCInterface.go @@ -38,9 +38,20 @@ func (_m *MaMPCInterface) EXPECT() *MaMPCInterface_Expecter { } // AddFeatures provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) AddFeatures() { - _mock.Called() - return +func (_mock *MaMPCInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // MaMPCInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -60,13 +71,13 @@ func (_c *MaMPCInterface_AddFeatures_Call) Run(run func()) *MaMPCInterface_AddFe return _c } -func (_c *MaMPCInterface_AddFeatures_Call) Return() *MaMPCInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *MaMPCInterface_AddFeatures_Call) Return(err error) *MaMPCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *MaMPCInterface_AddFeatures_Call) RunAndReturn(run func()) *MaMPCInterface_AddFeatures_Call { - _c.Run(run) +func (_c *MaMPCInterface_AddFeatures_Call) RunAndReturn(run func() error) *MaMPCInterface_AddFeatures_Call { + _c.Call.Return(run) return _c } diff --git a/usecases/mocks/MuMPCInterface.go b/usecases/mocks/MuMPCInterface.go new file mode 100644 index 00000000..37231e33 --- /dev/null +++ b/usecases/mocks/MuMPCInterface.go @@ -0,0 +1,1541 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "time" + + "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/model" + mock "github.com/stretchr/testify/mock" +) + +// NewMuMPCInterface creates a new instance of MuMPCInterface. 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 NewMuMPCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MuMPCInterface { + mock := &MuMPCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MuMPCInterface is an autogenerated mock type for the MuMPCInterface type +type MuMPCInterface struct { + mock.Mock +} + +type MuMPCInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MuMPCInterface) EXPECT() *MuMPCInterface_Expecter { + return &MuMPCInterface_Expecter{mock: &_m.Mock} +} + +// CurrentPerPhase provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) CurrentPerPhase() ([]float64, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for CurrentPerPhase") + } + + var r0 []float64 + var r1 error + if returnFunc, ok := ret.Get(0).(func() ([]float64, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() []float64); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]float64) + } + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MuMPCInterface_CurrentPerPhase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CurrentPerPhase' +type MuMPCInterface_CurrentPerPhase_Call struct { + *mock.Call +} + +// CurrentPerPhase is a helper method to define mock.On call +func (_e *MuMPCInterface_Expecter) CurrentPerPhase() *MuMPCInterface_CurrentPerPhase_Call { + return &MuMPCInterface_CurrentPerPhase_Call{Call: _e.mock.On("CurrentPerPhase")} +} + +func (_c *MuMPCInterface_CurrentPerPhase_Call) Run(run func()) *MuMPCInterface_CurrentPerPhase_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MuMPCInterface_CurrentPerPhase_Call) Return(float64s []float64, err error) *MuMPCInterface_CurrentPerPhase_Call { + _c.Call.Return(float64s, err) + return _c +} + +func (_c *MuMPCInterface_CurrentPerPhase_Call) RunAndReturn(run func() ([]float64, error)) *MuMPCInterface_CurrentPerPhase_Call { + _c.Call.Return(run) + return _c +} + +// EnergyConsumed provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) EnergyConsumed() (float64, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for EnergyConsumed") + } + + var r0 float64 + var r1 error + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(float64) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MuMPCInterface_EnergyConsumed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnergyConsumed' +type MuMPCInterface_EnergyConsumed_Call struct { + *mock.Call +} + +// EnergyConsumed is a helper method to define mock.On call +func (_e *MuMPCInterface_Expecter) EnergyConsumed() *MuMPCInterface_EnergyConsumed_Call { + return &MuMPCInterface_EnergyConsumed_Call{Call: _e.mock.On("EnergyConsumed")} +} + +func (_c *MuMPCInterface_EnergyConsumed_Call) Run(run func()) *MuMPCInterface_EnergyConsumed_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MuMPCInterface_EnergyConsumed_Call) Return(f float64, err error) *MuMPCInterface_EnergyConsumed_Call { + _c.Call.Return(f, err) + return _c +} + +func (_c *MuMPCInterface_EnergyConsumed_Call) RunAndReturn(run func() (float64, error)) *MuMPCInterface_EnergyConsumed_Call { + _c.Call.Return(run) + return _c +} + +// EnergyProduced provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) EnergyProduced() (float64, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for EnergyProduced") + } + + var r0 float64 + var r1 error + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(float64) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MuMPCInterface_EnergyProduced_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnergyProduced' +type MuMPCInterface_EnergyProduced_Call struct { + *mock.Call +} + +// EnergyProduced is a helper method to define mock.On call +func (_e *MuMPCInterface_Expecter) EnergyProduced() *MuMPCInterface_EnergyProduced_Call { + return &MuMPCInterface_EnergyProduced_Call{Call: _e.mock.On("EnergyProduced")} +} + +func (_c *MuMPCInterface_EnergyProduced_Call) Run(run func()) *MuMPCInterface_EnergyProduced_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MuMPCInterface_EnergyProduced_Call) Return(f float64, err error) *MuMPCInterface_EnergyProduced_Call { + _c.Call.Return(f, err) + return _c +} + +func (_c *MuMPCInterface_EnergyProduced_Call) RunAndReturn(run func() (float64, error)) *MuMPCInterface_EnergyProduced_Call { + _c.Call.Return(run) + return _c +} + +// Frequency provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) Frequency() (float64, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Frequency") + } + + var r0 float64 + var r1 error + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(float64) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MuMPCInterface_Frequency_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Frequency' +type MuMPCInterface_Frequency_Call struct { + *mock.Call +} + +// Frequency is a helper method to define mock.On call +func (_e *MuMPCInterface_Expecter) Frequency() *MuMPCInterface_Frequency_Call { + return &MuMPCInterface_Frequency_Call{Call: _e.mock.On("Frequency")} +} + +func (_c *MuMPCInterface_Frequency_Call) Run(run func()) *MuMPCInterface_Frequency_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MuMPCInterface_Frequency_Call) Return(f float64, err error) *MuMPCInterface_Frequency_Call { + _c.Call.Return(f, err) + return _c +} + +func (_c *MuMPCInterface_Frequency_Call) RunAndReturn(run func() (float64, error)) *MuMPCInterface_Frequency_Call { + _c.Call.Return(run) + return _c +} + +// Power provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) Power() (float64, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Power") + } + + var r0 float64 + var r1 error + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(float64) + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MuMPCInterface_Power_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Power' +type MuMPCInterface_Power_Call struct { + *mock.Call +} + +// Power is a helper method to define mock.On call +func (_e *MuMPCInterface_Expecter) Power() *MuMPCInterface_Power_Call { + return &MuMPCInterface_Power_Call{Call: _e.mock.On("Power")} +} + +func (_c *MuMPCInterface_Power_Call) Run(run func()) *MuMPCInterface_Power_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MuMPCInterface_Power_Call) Return(f float64, err error) *MuMPCInterface_Power_Call { + _c.Call.Return(f, err) + return _c +} + +func (_c *MuMPCInterface_Power_Call) RunAndReturn(run func() (float64, error)) *MuMPCInterface_Power_Call { + _c.Call.Return(run) + return _c +} + +// PowerPerPhase provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) PowerPerPhase() ([]float64, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for PowerPerPhase") + } + + var r0 []float64 + var r1 error + if returnFunc, ok := ret.Get(0).(func() ([]float64, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() []float64); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]float64) + } + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MuMPCInterface_PowerPerPhase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PowerPerPhase' +type MuMPCInterface_PowerPerPhase_Call struct { + *mock.Call +} + +// PowerPerPhase is a helper method to define mock.On call +func (_e *MuMPCInterface_Expecter) PowerPerPhase() *MuMPCInterface_PowerPerPhase_Call { + return &MuMPCInterface_PowerPerPhase_Call{Call: _e.mock.On("PowerPerPhase")} +} + +func (_c *MuMPCInterface_PowerPerPhase_Call) Run(run func()) *MuMPCInterface_PowerPerPhase_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MuMPCInterface_PowerPerPhase_Call) Return(float64s []float64, err error) *MuMPCInterface_PowerPerPhase_Call { + _c.Call.Return(float64s, err) + return _c +} + +func (_c *MuMPCInterface_PowerPerPhase_Call) RunAndReturn(run func() ([]float64, error)) *MuMPCInterface_PowerPerPhase_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) Update(data ...api.UpdateData) error { + var tmpRet mock.Arguments + if len(data) > 0 { + tmpRet = _mock.Called(data) + } else { + tmpRet = _mock.Called() + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(...api.UpdateData) error); ok { + r0 = returnFunc(data...) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MuMPCInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MuMPCInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - data ...api.UpdateData +func (_e *MuMPCInterface_Expecter) Update(data ...interface{}) *MuMPCInterface_Update_Call { + return &MuMPCInterface_Update_Call{Call: _e.mock.On("Update", + append([]interface{}{}, data...)...)} +} + +func (_c *MuMPCInterface_Update_Call) Run(run func(data ...api.UpdateData)) *MuMPCInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []api.UpdateData + var variadicArgs []api.UpdateData + if len(args) > 0 { + variadicArgs = args[0].([]api.UpdateData) + } + arg0 = variadicArgs + run( + arg0..., + ) + }) + return _c +} + +func (_c *MuMPCInterface_Update_Call) Return(err error) *MuMPCInterface_Update_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MuMPCInterface_Update_Call) RunAndReturn(run func(data ...api.UpdateData) error) *MuMPCInterface_Update_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataCurrentPhaseA provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataCurrentPhaseA") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataCurrentPhaseA_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataCurrentPhaseA' +type MuMPCInterface_UpdateDataCurrentPhaseA_Call struct { + *mock.Call +} + +// UpdateDataCurrentPhaseA is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataCurrentPhaseA(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { + return &MuMPCInterface_UpdateDataCurrentPhaseA_Call{Call: _e.mock.On("UpdateDataCurrentPhaseA", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataCurrentPhaseB provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataCurrentPhaseB") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataCurrentPhaseB_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataCurrentPhaseB' +type MuMPCInterface_UpdateDataCurrentPhaseB_Call struct { + *mock.Call +} + +// UpdateDataCurrentPhaseB is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataCurrentPhaseB(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { + return &MuMPCInterface_UpdateDataCurrentPhaseB_Call{Call: _e.mock.On("UpdateDataCurrentPhaseB", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataCurrentPhaseC provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataCurrentPhaseC") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataCurrentPhaseC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataCurrentPhaseC' +type MuMPCInterface_UpdateDataCurrentPhaseC_Call struct { + *mock.Call +} + +// UpdateDataCurrentPhaseC is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataCurrentPhaseC(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { + return &MuMPCInterface_UpdateDataCurrentPhaseC_Call{Call: _e.mock.On("UpdateDataCurrentPhaseC", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataEnergyConsumed provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataEnergyConsumed(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataEnergyConsumed") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState, evaluationStart, evaluationEnd) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataEnergyConsumed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataEnergyConsumed' +type MuMPCInterface_UpdateDataEnergyConsumed_Call struct { + *mock.Call +} + +// UpdateDataEnergyConsumed is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +// - evaluationStart *time.Time +// - evaluationEnd *time.Time +func (_e *MuMPCInterface_Expecter) UpdateDataEnergyConsumed(value interface{}, timestamp interface{}, valueState interface{}, evaluationStart interface{}, evaluationEnd interface{}) *MuMPCInterface_UpdateDataEnergyConsumed_Call { + return &MuMPCInterface_UpdateDataEnergyConsumed_Call{Call: _e.mock.On("UpdateDataEnergyConsumed", value, timestamp, valueState, evaluationStart, evaluationEnd)} +} + +func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time)) *MuMPCInterface_UpdateDataEnergyConsumed_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + var arg3 *time.Time + if args[3] != nil { + arg3 = args[3].(*time.Time) + } + var arg4 *time.Time + if args[4] != nil { + arg4 = args[4].(*time.Time) + } + run( + arg0, + arg1, + arg2, + arg3, + arg4, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataEnergyProduced provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataEnergyProduced(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataEnergyProduced") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState, evaluationStart, evaluationEnd) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataEnergyProduced_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataEnergyProduced' +type MuMPCInterface_UpdateDataEnergyProduced_Call struct { + *mock.Call +} + +// UpdateDataEnergyProduced is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +// - evaluationStart *time.Time +// - evaluationEnd *time.Time +func (_e *MuMPCInterface_Expecter) UpdateDataEnergyProduced(value interface{}, timestamp interface{}, valueState interface{}, evaluationStart interface{}, evaluationEnd interface{}) *MuMPCInterface_UpdateDataEnergyProduced_Call { + return &MuMPCInterface_UpdateDataEnergyProduced_Call{Call: _e.mock.On("UpdateDataEnergyProduced", value, timestamp, valueState, evaluationStart, evaluationEnd)} +} + +func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time)) *MuMPCInterface_UpdateDataEnergyProduced_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + var arg3 *time.Time + if args[3] != nil { + arg3 = args[3].(*time.Time) + } + var arg4 *time.Time + if args[4] != nil { + arg4 = args[4].(*time.Time) + } + run( + arg0, + arg1, + arg2, + arg3, + arg4, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataEnergyProduced_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateData) *MuMPCInterface_UpdateDataEnergyProduced_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataFrequency provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataFrequency") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataFrequency_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataFrequency' +type MuMPCInterface_UpdateDataFrequency_Call struct { + *mock.Call +} + +// UpdateDataFrequency is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataFrequency(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataFrequency_Call { + return &MuMPCInterface_UpdateDataFrequency_Call{Call: _e.mock.On("UpdateDataFrequency", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataFrequency_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataFrequency_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataFrequency_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataFrequency_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataFrequency_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataFrequency_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataPowerPhaseA provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataPowerPhaseA") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataPowerPhaseA_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataPowerPhaseA' +type MuMPCInterface_UpdateDataPowerPhaseA_Call struct { + *mock.Call +} + +// UpdateDataPowerPhaseA is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataPowerPhaseA(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataPowerPhaseA_Call { + return &MuMPCInterface_UpdateDataPowerPhaseA_Call{Call: _e.mock.On("UpdateDataPowerPhaseA", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerPhaseA_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataPowerPhaseB provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataPowerPhaseB") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataPowerPhaseB_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataPowerPhaseB' +type MuMPCInterface_UpdateDataPowerPhaseB_Call struct { + *mock.Call +} + +// UpdateDataPowerPhaseB is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataPowerPhaseB(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataPowerPhaseB_Call { + return &MuMPCInterface_UpdateDataPowerPhaseB_Call{Call: _e.mock.On("UpdateDataPowerPhaseB", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerPhaseB_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataPowerPhaseC provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataPowerPhaseC") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataPowerPhaseC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataPowerPhaseC' +type MuMPCInterface_UpdateDataPowerPhaseC_Call struct { + *mock.Call +} + +// UpdateDataPowerPhaseC is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataPowerPhaseC(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataPowerPhaseC_Call { + return &MuMPCInterface_UpdateDataPowerPhaseC_Call{Call: _e.mock.On("UpdateDataPowerPhaseC", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerPhaseC_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataPowerTotal provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataPowerTotal") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataPowerTotal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataPowerTotal' +type MuMPCInterface_UpdateDataPowerTotal_Call struct { + *mock.Call +} + +// UpdateDataPowerTotal is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataPowerTotal(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataPowerTotal_Call { + return &MuMPCInterface_UpdateDataPowerTotal_Call{Call: _e.mock.On("UpdateDataPowerTotal", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerTotal_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataPowerTotal_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataPowerTotal_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseA provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseA") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataVoltagePhaseA_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseA' +type MuMPCInterface_UpdateDataVoltagePhaseA_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseA is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseA(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { + return &MuMPCInterface_UpdateDataVoltagePhaseA_Call{Call: _e.mock.On("UpdateDataVoltagePhaseA", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseAToB provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseAToB") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataVoltagePhaseAToB_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseAToB' +type MuMPCInterface_UpdateDataVoltagePhaseAToB_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseAToB is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseAToB(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { + return &MuMPCInterface_UpdateDataVoltagePhaseAToB_Call{Call: _e.mock.On("UpdateDataVoltagePhaseAToB", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseB provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseB") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataVoltagePhaseB_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseB' +type MuMPCInterface_UpdateDataVoltagePhaseB_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseB is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseB(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { + return &MuMPCInterface_UpdateDataVoltagePhaseB_Call{Call: _e.mock.On("UpdateDataVoltagePhaseB", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseBToC provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseBToC") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataVoltagePhaseBToC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseBToC' +type MuMPCInterface_UpdateDataVoltagePhaseBToC_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseBToC is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseBToC(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { + return &MuMPCInterface_UpdateDataVoltagePhaseBToC_Call{Call: _e.mock.On("UpdateDataVoltagePhaseBToC", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseC provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseC") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataVoltagePhaseC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseC' +type MuMPCInterface_UpdateDataVoltagePhaseC_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseC is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseC(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { + return &MuMPCInterface_UpdateDataVoltagePhaseC_Call{Call: _e.mock.On("UpdateDataVoltagePhaseC", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseCToA provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseCToA") + } + + var r0 api.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateData) + } + } + return r0 +} + +// MuMPCInterface_UpdateDataVoltagePhaseCToA_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseCToA' +type MuMPCInterface_UpdateDataVoltagePhaseCToA_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseCToA is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseCToA(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { + return &MuMPCInterface_UpdateDataVoltagePhaseCToA_Call{Call: _e.mock.On("UpdateDataVoltagePhaseCToA", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { + _c.Call.Return(run) + return _c +} + +// VoltagePerPhase provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) VoltagePerPhase() ([]float64, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for VoltagePerPhase") + } + + var r0 []float64 + var r1 error + if returnFunc, ok := ret.Get(0).(func() ([]float64, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() []float64); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]float64) + } + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MuMPCInterface_VoltagePerPhase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VoltagePerPhase' +type MuMPCInterface_VoltagePerPhase_Call struct { + *mock.Call +} + +// VoltagePerPhase is a helper method to define mock.On call +func (_e *MuMPCInterface_Expecter) VoltagePerPhase() *MuMPCInterface_VoltagePerPhase_Call { + return &MuMPCInterface_VoltagePerPhase_Call{Call: _e.mock.On("VoltagePerPhase")} +} + +func (_c *MuMPCInterface_VoltagePerPhase_Call) Run(run func()) *MuMPCInterface_VoltagePerPhase_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MuMPCInterface_VoltagePerPhase_Call) Return(float64s []float64, err error) *MuMPCInterface_VoltagePerPhase_Call { + _c.Call.Return(float64s, err) + return _c +} + +func (_c *MuMPCInterface_VoltagePerPhase_Call) RunAndReturn(run func() ([]float64, error)) *MuMPCInterface_VoltagePerPhase_Call { + _c.Call.Return(run) + return _c +} diff --git a/usecases/mocks/UpdateData.go b/usecases/mocks/UpdateData.go new file mode 100644 index 00000000..caac19fd --- /dev/null +++ b/usecases/mocks/UpdateData.go @@ -0,0 +1,169 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "github.com/enbility/eebus-go/api" + mock "github.com/stretchr/testify/mock" +) + +// NewUpdateData creates a new instance of UpdateData. 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 NewUpdateData(t interface { + mock.TestingT + Cleanup(func()) +}) *UpdateData { + mock := &UpdateData{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// UpdateData is an autogenerated mock type for the UpdateData type +type UpdateData struct { + mock.Mock +} + +type UpdateData_Expecter struct { + mock *mock.Mock +} + +func (_m *UpdateData) EXPECT() *UpdateData_Expecter { + return &UpdateData_Expecter{mock: &_m.Mock} +} + +// MeasurementData provides a mock function for the type UpdateData +func (_mock *UpdateData) MeasurementData() api.MeasurementDataForID { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for MeasurementData") + } + + var r0 api.MeasurementDataForID + if returnFunc, ok := ret.Get(0).(func() api.MeasurementDataForID); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(api.MeasurementDataForID) + } + return r0 +} + +// UpdateData_MeasurementData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MeasurementData' +type UpdateData_MeasurementData_Call struct { + *mock.Call +} + +// MeasurementData is a helper method to define mock.On call +func (_e *UpdateData_Expecter) MeasurementData() *UpdateData_MeasurementData_Call { + return &UpdateData_MeasurementData_Call{Call: _e.mock.On("MeasurementData")} +} + +func (_c *UpdateData_MeasurementData_Call) Run(run func()) *UpdateData_MeasurementData_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *UpdateData_MeasurementData_Call) Return(measurementDataForID api.MeasurementDataForID) *UpdateData_MeasurementData_Call { + _c.Call.Return(measurementDataForID) + return _c +} + +func (_c *UpdateData_MeasurementData_Call) RunAndReturn(run func() api.MeasurementDataForID) *UpdateData_MeasurementData_Call { + _c.Call.Return(run) + return _c +} + +// NotSupportedError provides a mock function for the type UpdateData +func (_mock *UpdateData) NotSupportedError() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for NotSupportedError") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// UpdateData_NotSupportedError_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NotSupportedError' +type UpdateData_NotSupportedError_Call struct { + *mock.Call +} + +// NotSupportedError is a helper method to define mock.On call +func (_e *UpdateData_Expecter) NotSupportedError() *UpdateData_NotSupportedError_Call { + return &UpdateData_NotSupportedError_Call{Call: _e.mock.On("NotSupportedError")} +} + +func (_c *UpdateData_NotSupportedError_Call) Run(run func()) *UpdateData_NotSupportedError_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *UpdateData_NotSupportedError_Call) Return(err error) *UpdateData_NotSupportedError_Call { + _c.Call.Return(err) + return _c +} + +func (_c *UpdateData_NotSupportedError_Call) RunAndReturn(run func() error) *UpdateData_NotSupportedError_Call { + _c.Call.Return(run) + return _c +} + +// Supported provides a mock function for the type UpdateData +func (_mock *UpdateData) Supported() bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Supported") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// UpdateData_Supported_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Supported' +type UpdateData_Supported_Call struct { + *mock.Call +} + +// Supported is a helper method to define mock.On call +func (_e *UpdateData_Expecter) Supported() *UpdateData_Supported_Call { + return &UpdateData_Supported_Call{Call: _e.mock.On("Supported")} +} + +func (_c *UpdateData_Supported_Call) Run(run func()) *UpdateData_Supported_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *UpdateData_Supported_Call) Return(b bool) *UpdateData_Supported_Call { + _c.Call.Return(b) + return _c +} + +func (_c *UpdateData_Supported_Call) RunAndReturn(run func() bool) *UpdateData_Supported_Call { + _c.Call.Return(run) + return _c +} From 0d753000e45804186b73792a17240bd1adc865a2 Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Fri, 29 Nov 2024 11:01:22 +0100 Subject: [PATCH 17/61] Check AddFeatures return values in tests --- usecases/cs/lpc/testhelper_test.go | 3 ++- usecases/cs/lpp/testhelper_test.go | 3 ++- usecases/mu/mpc/testhelper_test.go | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/usecases/cs/lpc/testhelper_test.go b/usecases/cs/lpc/testhelper_test.go index 25b3059b..3f759138 100644 --- a/usecases/cs/lpc/testhelper_test.go +++ b/usecases/cs/lpc/testhelper_test.go @@ -16,6 +16,7 @@ import ( "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/spine" "github.com/enbility/spine-go/util" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" ) @@ -76,7 +77,7 @@ func (s *CsLPCSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewLPC(localEntity, s.Event) - _ = s.sut.AddFeatures() + assert.Nil(s.T(), s.sut.AddFeatures()) s.sut.AddUseCase() s.loadControlFeature = localEntity.FeatureOfTypeAndRole(model.FeatureTypeTypeLoadControl, model.RoleTypeServer) diff --git a/usecases/cs/lpp/testhelper_test.go b/usecases/cs/lpp/testhelper_test.go index 6292b311..f6679d4e 100644 --- a/usecases/cs/lpp/testhelper_test.go +++ b/usecases/cs/lpp/testhelper_test.go @@ -16,6 +16,7 @@ import ( "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/spine" "github.com/enbility/spine-go/util" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" ) @@ -76,7 +77,7 @@ func (s *CsLPPSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewLPP(localEntity, s.Event) - _ = s.sut.AddFeatures() + assert.Nil(s.T(), s.sut.AddFeatures()) s.sut.AddUseCase() s.loadControlFeature = localEntity.FeatureOfTypeAndRole(model.FeatureTypeTypeLoadControl, model.RoleTypeServer) diff --git a/usecases/mu/mpc/testhelper_test.go b/usecases/mu/mpc/testhelper_test.go index f0def4a9..2e503215 100644 --- a/usecases/mu/mpc/testhelper_test.go +++ b/usecases/mu/mpc/testhelper_test.go @@ -1,10 +1,11 @@ package mpc import ( - "github.com/enbility/eebus-go/features/server" "slices" "time" + "github.com/enbility/eebus-go/features/server" + "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/mocks" "github.com/enbility/eebus-go/service" @@ -12,6 +13,7 @@ import ( "github.com/enbility/ship-go/cert" spineapi "github.com/enbility/spine-go/api" "github.com/enbility/spine-go/model" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" ) @@ -78,7 +80,7 @@ func (s *MuMPCSuite) BeforeTest(_, _ string) { s.frequencyConfig, ) - _ = s.sut.AddFeatures() + assert.Nil(s.T(), s.sut.AddFeatures()) s.sut.AddUseCase() } From 832fb394ef3eebb44337b1c2c4e9cb281fa1b254 Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Fri, 29 Nov 2024 12:04:53 +0100 Subject: [PATCH 18/61] Increase test coverage --- usecases/mu/mpc/public_constraint_test.go | 225 ++++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 usecases/mu/mpc/public_constraint_test.go diff --git a/usecases/mu/mpc/public_constraint_test.go b/usecases/mu/mpc/public_constraint_test.go new file mode 100644 index 00000000..2c9f35f3 --- /dev/null +++ b/usecases/mu/mpc/public_constraint_test.go @@ -0,0 +1,225 @@ +package mpc + +import ( + "testing" + "time" + + "github.com/enbility/eebus-go/features/server" + ucapi "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" +) + +type MuMpcConstraintSuite struct { + suite.Suite + *MuMPCSuite +} + +func TestMuMpcConstraintSuite(t *testing.T) { + suite.Run(t, new(MuMpcConstraintSuite)) +} + +func (s *MuMpcConstraintSuite) BeforeTest(suiteName, testName string) { + s.MuMPCSuite = NewMuMPCSuite( + &s.Suite, + &MonitorPowerConfig{ + ConnectedPhases: ConnectedPhasesA, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueConstraintsTotal: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueStepSize: model.NewScaledNumberType(0.1), + }), + ValueConstraintsPhaseA: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueStepSize: model.NewScaledNumberType(0.1), + }), + }, + &MonitorEnergyConfig{ + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueConstraintsConsumption: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueStepSize: model.NewScaledNumberType(100), + }), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueConstraintsPhaseA: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(32), + ValueStepSize: model.NewScaledNumberType(0.1), + }), + }, + &MonitorVoltageConfig{ + SupportPhaseToPhase: false, + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueConstraintsPhaseA: util.Ptr(model.MeasurementConstraintsDataType{ + ValueStepSize: model.NewScaledNumberType(0.1), + }), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(40), + ValueRangeMax: model.NewScaledNumberType(60), + ValueStepSize: model.NewScaledNumberType(0.01), + }), + }, + ) + s.MuMPCSuite.BeforeTest(suiteName, testName) +} + +func (s *MuMpcConstraintSuite) Test_Power() { + err := s.sut.Update( + s.sut.UpdateDataPowerTotal(5.7, util.Ptr(time.Now()), nil), + ) + assert.Nil(s.T(), err) + + power, err := s.sut.Power() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.7, power) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, nil) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.7}, values) +} + +func (s *MuMpcConstraintSuite) Test_PowerPerPhase() { + err := s.sut.Update( + s.sut.UpdateDataPowerPhaseA(5.7, util.Ptr(time.Now()), nil), + ) + assert.Nil(s.T(), err) + + powerPerPhases, err := s.sut.PowerPerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.7}, powerPerPhases) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACPower), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.7}, values) +} + +func (s *MuMpcConstraintSuite) Test_EnergyConsumed() { + err := s.sut.Update( + s.sut.UpdateDataEnergyConsumed(570, util.Ptr(time.Now()), nil, util.Ptr(time.Now()), util.Ptr(time.Now())), + ) + assert.Nil(s.T(), err) + + energyConsumed, err := s.sut.EnergyConsumed() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 570.0, energyConsumed) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), + } + measurement, err := server.NewMeasurement(s.sut.LocalEntity) + assert.Nil(s.T(), err) + values, err := measurement.GetDataForFilter(filter) + assert.Nil(s.T(), err) + assert.Equal(s.T(), 1, len(values)) + assert.Equal(s.T(), 570.0, (*values[0].Value).GetValue()) +} + +func (s *MuMpcConstraintSuite) Test_EnergyProduced() { + err := s.sut.Update( + s.sut.UpdateDataEnergyProduced(5.0, nil, nil, nil, nil), + ) + assert.NotNil(s.T(), err) + + _, err = s.sut.EnergyProduced() + assert.NotNil(s.T(), err) + + // Check if the client filter works (it shouldn't) + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), + } + measurement, err := server.NewMeasurement(s.sut.LocalEntity) + assert.Nil(s.T(), err) + _, err = measurement.GetDataForFilter(filter) + assert.NotNil(s.T(), err) +} + +func (s *MuMpcConstraintSuite) Test_CurrentPerPhase() { + err := s.sut.Update( + s.sut.UpdateDataCurrentPhaseA(0.1, nil, nil), + ) + assert.Nil(s.T(), err) + + currentPerPhases, err := s.sut.CurrentPerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{0.1}, currentPerPhases) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{0.1}, values) +} + +func (s *MuMpcConstraintSuite) Test_VoltagePerPhase() { + err := s.sut.Update( + s.sut.UpdateDataVoltagePhaseA(230, nil, nil), + ) + assert.Nil(s.T(), err) + + voltagePerPhases, err := s.sut.VoltagePerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{230}, voltagePerPhases) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, "", ucapi.PhaseNameMapping) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{230}, values) +} + +func (s *MuMpcConstraintSuite) Test_Frequency() { + err := s.sut.Update( + s.sut.UpdateDataFrequency(50, nil, nil), + ) + assert.Nil(s.T(), err) + + frequency, err := s.sut.Frequency() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 50.0, frequency) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), + } + measurements, err := server.NewMeasurement(s.sut.LocalEntity) + assert.Nil(s.T(), err) + values, err := measurements.GetDataForFilter(filter) + assert.Nil(s.T(), err) + assert.Equal(s.T(), 1, len(values)) + assert.Equal(s.T(), 50.0, (*values[0].Value).GetValue()) +} From 878f1e37ebea96be42959bd071cfacc64a85c6e5 Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Fri, 29 Nov 2024 12:47:22 +0100 Subject: [PATCH 19/61] Address comments during code review --- api/usecases.go | 11 +- service/service.go | 7 + usecases/api/api.go | 29 ++- usecases/api/mu_mpc.go | 44 ++-- usecases/mocks/MuMPCInterface.go | 240 +++++++++++----------- usecases/mocks/UpdateData.go | 45 ---- usecases/mocks/UpdateMeasurementData.go | 169 +++++++++++++++ usecases/mu/mpc/public.go | 37 ++-- usecases/mu/mpc/public_abc_test.go | 12 +- usecases/mu/mpc/public_bc_test.go | 6 +- usecases/mu/mpc/public_constraint_test.go | 1 + usecases/mu/mpc/usecase.go | 19 ++ 12 files changed, 405 insertions(+), 215 deletions(-) create mode 100644 usecases/mocks/UpdateMeasurementData.go diff --git a/api/usecases.go b/api/usecases.go index b5660055..37203270 100644 --- a/api/usecases.go +++ b/api/usecases.go @@ -56,6 +56,15 @@ type UseCaseBaseInterface interface { type UseCaseInterface interface { UseCaseBaseInterface - // add the features + // add the features described by the Use Case + // + // returns an error if any Feature could not be added + // - errors should not occur during normal usage of eebus-go, and should + // generally be considered fatal implementation errors + // - if an error occurs while adding features to a new Entity, that Entity + // will be in an incomplete state and should not be added to the service + // + // No cleanup occurs on error, some features may end up partially + // configured and unused AddFeatures() error } diff --git a/service/service.go b/service/service.go index d1722d11..97b53dfd 100644 --- a/service/service.go +++ b/service/service.go @@ -205,6 +205,13 @@ func (s *Service) IsRunning() bool { } // add a use case to the service +// +// returns an error when adding features to the entity fails +// +// errors should not occur during normal usage of eebus-go, and should +// generally be considered fatal implementation errors +// +// see usecase.AddFeatures() for more information func (s *Service) AddUseCase(useCase api.UseCaseInterface) error { s.usecases = append(s.usecases, useCase) diff --git a/usecases/api/api.go b/usecases/api/api.go index 898b38b1..4bbeb772 100644 --- a/usecases/api/api.go +++ b/usecases/api/api.go @@ -1,7 +1,34 @@ package api -import "github.com/enbility/spine-go/model" +import ( + "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/model" +) //go:generate mockery var PhaseNameMapping = []model.ElectricalConnectionPhaseNameType{model.ElectricalConnectionPhaseNameTypeA, model.ElectricalConnectionPhaseNameTypeB, model.ElectricalConnectionPhaseNameTypeC} + +// used to enable batch data updates for certain usecases +// +// a usecase that wants to provide batch update capabilities using this interface should +// +// 1. provide methods that return a type implementing this interface +// 2. provide an Update method that accepts a list of this interface +// +// The Update method can then iterate over the provided UpdateData, ensure all +// data points are supported, and then create a batched spine update request +type UpdateData interface { + Supported() bool + NotSupportedError() error +} + +// used to enable batch data updates for MeaserumentData +// +// usecases can use this interface to provide batch update capabilities by +// implementing a method that takes a list of this interface and passes a list +// of MeasurementData to Measurement.UpdateDataForIds +type UpdateMeasurementData interface { + UpdateData + MeasurementData() api.MeasurementDataForID +} diff --git a/usecases/api/mu_mpc.go b/usecases/api/mu_mpc.go index 8d687580..b3e6a63a 100644 --- a/usecases/api/mu_mpc.go +++ b/usecases/api/mu_mpc.go @@ -1,9 +1,9 @@ package api import ( - "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/model" "time" + + "github.com/enbility/spine-go/model" ) // Actor: Monitoring Unit @@ -91,29 +91,29 @@ type MuMPCInterface interface { // possible errors: // - ErrMissingData if the id is not available // - and others - Update(data ...UpdateData) error + Update(data ...UpdateMeasurementData) error // Scenario 1 // use UpdateDataPowerTotal in Update to set the momentary active power consumption or production // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // use UpdateDataPowerPhaseA in Update to set the momentary active power consumption or production per phase // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // use UpdateDataPowerPhaseB in Update to set the momentary active power consumption or production per phase // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // use UpdateDataPowerPhaseC in Update to set the momentary active power consumption or production per phase // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // Scenario 2 @@ -127,7 +127,7 @@ type MuMPCInterface interface { valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time, - ) UpdateData + ) UpdateMeasurementData // use UpdateDataEnergyProduced in Update to set the total feed in energy // The timestamp is optional and can be nil @@ -139,67 +139,61 @@ type MuMPCInterface interface { valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time, - ) UpdateData + ) UpdateMeasurementData // Scenario 3 // use UpdateDataCurrentPhaseA in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // use UpdateDataCurrentPhaseB in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // use UpdateDataCurrentPhaseC in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // Scenario 4 // use UpdateDataVoltagePhaseA in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // use UpdateDataVoltagePhaseB in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // use UpdateDataVoltagePhaseC in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // use UpdateDataVoltagePhaseAToB in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // use UpdateDataVoltagePhaseBToC in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // use UpdateDataVoltagePhaseCToA in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData + UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // Scenario 5 // use AcFrequency in Update to set the frequency // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateData -} - -type UpdateData interface { - Supported() bool - NotSupportedError() error - MeasurementData() api.MeasurementDataForID + UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData } diff --git a/usecases/mocks/MuMPCInterface.go b/usecases/mocks/MuMPCInterface.go index 37231e33..5cb2430f 100644 --- a/usecases/mocks/MuMPCInterface.go +++ b/usecases/mocks/MuMPCInterface.go @@ -362,7 +362,7 @@ func (_c *MuMPCInterface_PowerPerPhase_Call) RunAndReturn(run func() ([]float64, } // Update provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) Update(data ...api.UpdateData) error { +func (_mock *MuMPCInterface) Update(data ...api.UpdateMeasurementData) error { var tmpRet mock.Arguments if len(data) > 0 { tmpRet = _mock.Called(data) @@ -376,7 +376,7 @@ func (_mock *MuMPCInterface) Update(data ...api.UpdateData) error { } var r0 error - if returnFunc, ok := ret.Get(0).(func(...api.UpdateData) error); ok { + if returnFunc, ok := ret.Get(0).(func(...api.UpdateMeasurementData) error); ok { r0 = returnFunc(data...) } else { r0 = ret.Error(0) @@ -390,18 +390,18 @@ type MuMPCInterface_Update_Call struct { } // Update is a helper method to define mock.On call -// - data ...api.UpdateData +// - data ...api.UpdateMeasurementData func (_e *MuMPCInterface_Expecter) Update(data ...interface{}) *MuMPCInterface_Update_Call { return &MuMPCInterface_Update_Call{Call: _e.mock.On("Update", append([]interface{}{}, data...)...)} } -func (_c *MuMPCInterface_Update_Call) Run(run func(data ...api.UpdateData)) *MuMPCInterface_Update_Call { +func (_c *MuMPCInterface_Update_Call) Run(run func(data ...api.UpdateMeasurementData)) *MuMPCInterface_Update_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []api.UpdateData - var variadicArgs []api.UpdateData + var arg0 []api.UpdateMeasurementData + var variadicArgs []api.UpdateMeasurementData if len(args) > 0 { - variadicArgs = args[0].([]api.UpdateData) + variadicArgs = args[0].([]api.UpdateMeasurementData) } arg0 = variadicArgs run( @@ -416,25 +416,25 @@ func (_c *MuMPCInterface_Update_Call) Return(err error) *MuMPCInterface_Update_C return _c } -func (_c *MuMPCInterface_Update_Call) RunAndReturn(run func(data ...api.UpdateData) error) *MuMPCInterface_Update_Call { +func (_c *MuMPCInterface_Update_Call) RunAndReturn(run func(data ...api.UpdateMeasurementData) error) *MuMPCInterface_Update_Call { _c.Call.Return(run) return _c } // UpdateDataCurrentPhaseA provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataCurrentPhaseA") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -476,30 +476,30 @@ func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) Run(run func(value float6 return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { +func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { _c.Call.Return(run) return _c } // UpdateDataCurrentPhaseB provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataCurrentPhaseB") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -541,30 +541,30 @@ func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) Run(run func(value float6 return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { +func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { _c.Call.Return(run) return _c } // UpdateDataCurrentPhaseC provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataCurrentPhaseC") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -606,30 +606,30 @@ func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) Run(run func(value float6 return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { +func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { _c.Call.Return(run) return _c } // UpdateDataEnergyConsumed provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataEnergyConsumed(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataEnergyConsumed(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) if len(ret) == 0 { panic("no return value specified for UpdateDataEnergyConsumed") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState, evaluationStart, evaluationEnd) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -683,30 +683,30 @@ func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) Run(run func(value float return _c } -func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { +func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { _c.Call.Return(run) return _c } // UpdateDataEnergyProduced provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataEnergyProduced(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataEnergyProduced(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) if len(ret) == 0 { panic("no return value specified for UpdateDataEnergyProduced") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState, evaluationStart, evaluationEnd) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -760,30 +760,30 @@ func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) Run(run func(value float return _c } -func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataEnergyProduced_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyProduced_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateData) *MuMPCInterface_UpdateDataEnergyProduced_Call { +func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyProduced_Call { _c.Call.Return(run) return _c } // UpdateDataFrequency provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataFrequency") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -825,30 +825,30 @@ func (_c *MuMPCInterface_UpdateDataFrequency_Call) Run(run func(value float64, t return _c } -func (_c *MuMPCInterface_UpdateDataFrequency_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataFrequency_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataFrequency_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataFrequency_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataFrequency_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataFrequency_Call { +func (_c *MuMPCInterface_UpdateDataFrequency_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataFrequency_Call { _c.Call.Return(run) return _c } // UpdateDataPowerPhaseA provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerPhaseA") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -890,30 +890,30 @@ func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) Run(run func(value float64, return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { +func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { _c.Call.Return(run) return _c } // UpdateDataPowerPhaseB provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerPhaseB") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -955,30 +955,30 @@ func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) Run(run func(value float64, return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { +func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { _c.Call.Return(run) return _c } // UpdateDataPowerPhaseC provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerPhaseC") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -1020,30 +1020,30 @@ func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) Run(run func(value float64, return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { +func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { _c.Call.Return(run) return _c } // UpdateDataPowerTotal provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerTotal") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -1085,30 +1085,30 @@ func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) Run(run func(value float64, return _c } -func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataPowerTotal_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerTotal_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataPowerTotal_Call { +func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerTotal_Call { _c.Call.Return(run) return _c } // UpdateDataVoltagePhaseA provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseA") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -1150,30 +1150,30 @@ func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) Run(run func(value float6 return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { _c.Call.Return(run) return _c } // UpdateDataVoltagePhaseAToB provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseAToB") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -1215,30 +1215,30 @@ func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) Run(run func(value flo return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { _c.Call.Return(run) return _c } // UpdateDataVoltagePhaseB provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseB") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -1280,30 +1280,30 @@ func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) Run(run func(value float6 return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { _c.Call.Return(run) return _c } // UpdateDataVoltagePhaseBToC provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseBToC") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -1345,30 +1345,30 @@ func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) Run(run func(value flo return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { _c.Call.Return(run) return _c } // UpdateDataVoltagePhaseC provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseC") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -1410,30 +1410,30 @@ func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) Run(run func(value float6 return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { _c.Call.Return(run) return _c } // UpdateDataVoltagePhaseCToA provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData { +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseCToA") } - var r0 api.UpdateData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateData); ok { + var r0 api.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateData) + r0 = ret.Get(0).(api.UpdateMeasurementData) } } return r0 @@ -1475,12 +1475,12 @@ func (_c *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call) Run(run func(value flo return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call) Return(updateData api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { - _c.Call.Return(updateData) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateData) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { _c.Call.Return(run) return _c } diff --git a/usecases/mocks/UpdateData.go b/usecases/mocks/UpdateData.go index caac19fd..126bcac6 100644 --- a/usecases/mocks/UpdateData.go +++ b/usecases/mocks/UpdateData.go @@ -5,7 +5,6 @@ package mocks import ( - "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" ) @@ -36,50 +35,6 @@ func (_m *UpdateData) EXPECT() *UpdateData_Expecter { return &UpdateData_Expecter{mock: &_m.Mock} } -// MeasurementData provides a mock function for the type UpdateData -func (_mock *UpdateData) MeasurementData() api.MeasurementDataForID { - ret := _mock.Called() - - if len(ret) == 0 { - panic("no return value specified for MeasurementData") - } - - var r0 api.MeasurementDataForID - if returnFunc, ok := ret.Get(0).(func() api.MeasurementDataForID); ok { - r0 = returnFunc() - } else { - r0 = ret.Get(0).(api.MeasurementDataForID) - } - return r0 -} - -// UpdateData_MeasurementData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MeasurementData' -type UpdateData_MeasurementData_Call struct { - *mock.Call -} - -// MeasurementData is a helper method to define mock.On call -func (_e *UpdateData_Expecter) MeasurementData() *UpdateData_MeasurementData_Call { - return &UpdateData_MeasurementData_Call{Call: _e.mock.On("MeasurementData")} -} - -func (_c *UpdateData_MeasurementData_Call) Run(run func()) *UpdateData_MeasurementData_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *UpdateData_MeasurementData_Call) Return(measurementDataForID api.MeasurementDataForID) *UpdateData_MeasurementData_Call { - _c.Call.Return(measurementDataForID) - return _c -} - -func (_c *UpdateData_MeasurementData_Call) RunAndReturn(run func() api.MeasurementDataForID) *UpdateData_MeasurementData_Call { - _c.Call.Return(run) - return _c -} - // NotSupportedError provides a mock function for the type UpdateData func (_mock *UpdateData) NotSupportedError() error { ret := _mock.Called() diff --git a/usecases/mocks/UpdateMeasurementData.go b/usecases/mocks/UpdateMeasurementData.go new file mode 100644 index 00000000..cd750857 --- /dev/null +++ b/usecases/mocks/UpdateMeasurementData.go @@ -0,0 +1,169 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "github.com/enbility/eebus-go/api" + mock "github.com/stretchr/testify/mock" +) + +// NewUpdateMeasurementData creates a new instance of UpdateMeasurementData. 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 NewUpdateMeasurementData(t interface { + mock.TestingT + Cleanup(func()) +}) *UpdateMeasurementData { + mock := &UpdateMeasurementData{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// UpdateMeasurementData is an autogenerated mock type for the UpdateMeasurementData type +type UpdateMeasurementData struct { + mock.Mock +} + +type UpdateMeasurementData_Expecter struct { + mock *mock.Mock +} + +func (_m *UpdateMeasurementData) EXPECT() *UpdateMeasurementData_Expecter { + return &UpdateMeasurementData_Expecter{mock: &_m.Mock} +} + +// MeasurementData provides a mock function for the type UpdateMeasurementData +func (_mock *UpdateMeasurementData) MeasurementData() api.MeasurementDataForID { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for MeasurementData") + } + + var r0 api.MeasurementDataForID + if returnFunc, ok := ret.Get(0).(func() api.MeasurementDataForID); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(api.MeasurementDataForID) + } + return r0 +} + +// UpdateMeasurementData_MeasurementData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MeasurementData' +type UpdateMeasurementData_MeasurementData_Call struct { + *mock.Call +} + +// MeasurementData is a helper method to define mock.On call +func (_e *UpdateMeasurementData_Expecter) MeasurementData() *UpdateMeasurementData_MeasurementData_Call { + return &UpdateMeasurementData_MeasurementData_Call{Call: _e.mock.On("MeasurementData")} +} + +func (_c *UpdateMeasurementData_MeasurementData_Call) Run(run func()) *UpdateMeasurementData_MeasurementData_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *UpdateMeasurementData_MeasurementData_Call) Return(measurementDataForID api.MeasurementDataForID) *UpdateMeasurementData_MeasurementData_Call { + _c.Call.Return(measurementDataForID) + return _c +} + +func (_c *UpdateMeasurementData_MeasurementData_Call) RunAndReturn(run func() api.MeasurementDataForID) *UpdateMeasurementData_MeasurementData_Call { + _c.Call.Return(run) + return _c +} + +// NotSupportedError provides a mock function for the type UpdateMeasurementData +func (_mock *UpdateMeasurementData) NotSupportedError() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for NotSupportedError") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// UpdateMeasurementData_NotSupportedError_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NotSupportedError' +type UpdateMeasurementData_NotSupportedError_Call struct { + *mock.Call +} + +// NotSupportedError is a helper method to define mock.On call +func (_e *UpdateMeasurementData_Expecter) NotSupportedError() *UpdateMeasurementData_NotSupportedError_Call { + return &UpdateMeasurementData_NotSupportedError_Call{Call: _e.mock.On("NotSupportedError")} +} + +func (_c *UpdateMeasurementData_NotSupportedError_Call) Run(run func()) *UpdateMeasurementData_NotSupportedError_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *UpdateMeasurementData_NotSupportedError_Call) Return(err error) *UpdateMeasurementData_NotSupportedError_Call { + _c.Call.Return(err) + return _c +} + +func (_c *UpdateMeasurementData_NotSupportedError_Call) RunAndReturn(run func() error) *UpdateMeasurementData_NotSupportedError_Call { + _c.Call.Return(run) + return _c +} + +// Supported provides a mock function for the type UpdateMeasurementData +func (_mock *UpdateMeasurementData) Supported() bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Supported") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// UpdateMeasurementData_Supported_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Supported' +type UpdateMeasurementData_Supported_Call struct { + *mock.Call +} + +// Supported is a helper method to define mock.On call +func (_e *UpdateMeasurementData_Expecter) Supported() *UpdateMeasurementData_Supported_Call { + return &UpdateMeasurementData_Supported_Call{Call: _e.mock.On("Supported")} +} + +func (_c *UpdateMeasurementData_Supported_Call) Run(run func()) *UpdateMeasurementData_Supported_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *UpdateMeasurementData_Supported_Call) Return(b bool) *UpdateMeasurementData_Supported_Call { + _c.Call.Return(b) + return _c +} + +func (_c *UpdateMeasurementData_Supported_Call) RunAndReturn(run func() bool) *UpdateMeasurementData_Supported_Call { + _c.Call.Return(run) + return _c +} diff --git a/usecases/mu/mpc/public.go b/usecases/mu/mpc/public.go index 2be81e7b..7e1e05f5 100644 --- a/usecases/mu/mpc/public.go +++ b/usecases/mu/mpc/public.go @@ -1,11 +1,12 @@ package mpc import ( + "time" + "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" usecaseapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/spine-go/model" - "time" ) // ------------------------- Getters ------------------------- // @@ -156,7 +157,7 @@ func (e *MPC) Frequency() (float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (e *MPC) Update(updateData ...usecaseapi.UpdateData) error { +func (e *MPC) Update(updateData ...usecaseapi.UpdateMeasurementData) error { measurements, err := server.NewMeasurement(e.LocalEntity) if err != nil { return err @@ -184,7 +185,7 @@ func (e *MPC) UpdateDataPowerTotal( acPowerTotal float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acPowerTotal is not supported, please check the configuration", e.acPowerTotal, @@ -206,7 +207,7 @@ func (e *MPC) UpdateDataPowerPhaseA( acPowerPhaseA float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acPowerPhaseA is not supported, please check the configuration", e.acPower[0], @@ -228,7 +229,7 @@ func (e *MPC) UpdateDataPowerPhaseB( acPowerPhaseB float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acPowerPhaseB is not supported, please check the configuration", e.acPower[1], @@ -250,7 +251,7 @@ func (e *MPC) UpdateDataPowerPhaseC( acPowerPhaseC float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acPowerPhaseC is not supported, please check the configuration", e.acPower[2], @@ -277,7 +278,7 @@ func (e *MPC) UpdateDataEnergyConsumed( valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acEnergyConsumed is not supported, please check the configuration", e.acEnergyConsumed, @@ -302,7 +303,7 @@ func (e *MPC) UpdateDataEnergyProduced( valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acEnergyProduced is not supported, please check the configuration", e.acEnergyProduced, @@ -326,7 +327,7 @@ func (e *MPC) UpdateDataCurrentPhaseA( acCurrentPhaseA float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acCurrentPhaseA is not supported, please check the configuration", e.acCurrent[0], @@ -348,7 +349,7 @@ func (e *MPC) UpdateDataCurrentPhaseB( acCurrentPhaseB float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acCurrentPhaseB is not supported, please check the configuration", e.acCurrent[1], @@ -370,7 +371,7 @@ func (e *MPC) UpdateDataCurrentPhaseC( acCurrentPhaseC float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acCurrentPhaseC is not supported, please check the configuration", e.acCurrent[2], @@ -394,7 +395,7 @@ func (e *MPC) UpdateDataVoltagePhaseA( voltagePhaseA float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acVoltagePhaseA is not supported, please check the configuration", e.acVoltage[0], @@ -416,7 +417,7 @@ func (e *MPC) UpdateDataVoltagePhaseB( voltagePhaseB float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acVoltagePhaseB is not supported, please check the configuration", e.acVoltage[1], @@ -438,7 +439,7 @@ func (e *MPC) UpdateDataVoltagePhaseC( voltagePhaseC float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acVoltagePhaseC is not supported, please check the configuration", e.acVoltage[2], @@ -460,7 +461,7 @@ func (e *MPC) UpdateDataVoltagePhaseAToB( voltagePhaseAToB float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acVoltagePhaseAToB is not supported, please check the configuration", e.acVoltage[3], @@ -482,7 +483,7 @@ func (e *MPC) UpdateDataVoltagePhaseBToC( voltagePhaseBToC float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acVoltagePhaseBToC is not supported, please check the configuration", e.acVoltage[4], @@ -504,7 +505,7 @@ func (e *MPC) UpdateDataVoltagePhaseCToA( voltagePhaseCToA float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acVoltagePhaseCToA is not supported, please check the configuration", e.acVoltage[5], @@ -528,7 +529,7 @@ func (e *MPC) UpdateDataFrequency( frequency float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.UpdateData { +) usecaseapi.UpdateMeasurementData { return newUpdateData( "acFrequency is not supported, please check the configuration", e.acFrequency, diff --git a/usecases/mu/mpc/public_abc_test.go b/usecases/mu/mpc/public_abc_test.go index dc1cc3e1..25f7209d 100644 --- a/usecases/mu/mpc/public_abc_test.go +++ b/usecases/mu/mpc/public_abc_test.go @@ -1,14 +1,15 @@ package mpc import ( + "testing" + "time" + "github.com/enbility/eebus-go/features/server" ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/util" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" - "testing" - "time" ) type MuMpcAbcSuite struct { @@ -16,6 +17,7 @@ type MuMpcAbcSuite struct { *MuMPCSuite } +// Test suite testing an MPC MonitoredUnit that supports 3-phase metering (phases ABC) func TestMuMpcAbcSuite(t *testing.T) { suite.Run(t, new(MuMpcAbcSuite)) } @@ -31,7 +33,11 @@ func (s *MuMpcAbcSuite) BeforeTest(suiteName, testName string) { ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), }, &MonitorEnergyConfig{ - ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueConstraintsProduction: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueStepSize: model.NewScaledNumberType(0.001), + }), ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), }, &MonitorCurrentConfig{ diff --git a/usecases/mu/mpc/public_bc_test.go b/usecases/mu/mpc/public_bc_test.go index cbefdc5b..f12646cd 100644 --- a/usecases/mu/mpc/public_bc_test.go +++ b/usecases/mu/mpc/public_bc_test.go @@ -1,13 +1,14 @@ package mpc import ( + "testing" + "time" + ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/util" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" - "testing" - "time" ) type MuMpcBcSuite struct { @@ -15,6 +16,7 @@ type MuMpcBcSuite struct { *MuMPCSuite } +// Test suite testing an MPC MonitoredUnit that supports metering for 2 phases (phases AB) func TestMuMpcAbSuite(t *testing.T) { suite.Run(t, new(MuMpcBcSuite)) } diff --git a/usecases/mu/mpc/public_constraint_test.go b/usecases/mu/mpc/public_constraint_test.go index 2c9f35f3..e70db4a5 100644 --- a/usecases/mu/mpc/public_constraint_test.go +++ b/usecases/mu/mpc/public_constraint_test.go @@ -17,6 +17,7 @@ type MuMpcConstraintSuite struct { *MuMPCSuite } +// Test suite testing an MPC MonitoredUnit that uses ValueConstraints on its measurements func TestMuMpcConstraintSuite(t *testing.T) { suite.Run(t, new(MuMpcConstraintSuite)) } diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index 1a0e11b4..e2b1a3d9 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -2,6 +2,7 @@ package mpc import ( "errors" + "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" "github.com/enbility/eebus-go/usecases/usecase" @@ -189,6 +190,8 @@ func (e *MPC) AddFeatures() error { } } + // if any of the configured measurements set constraints, update the + // measurementFeature with those accumulated constraints if len(constraints) > 0 { measurementFeature.UpdateData( model.FunctionTypeMeasurementConstraintsListData, @@ -218,6 +221,8 @@ func (e *MPC) configureMonitorPower( ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), }) + // if constraints are configured for acPowerTotal, set the + // constraint id and update measurementsConstraintData if e.powerConfig.ValueConstraintsTotal != nil { e.powerConfig.ValueConstraintsTotal.MeasurementId = e.acPowerTotal *measurementsConstraintData = append(*measurementsConstraintData, *e.powerConfig.ValueConstraintsTotal) @@ -259,6 +264,8 @@ func (e *MPC) configureMonitorPower( ScopeType: util.Ptr(model.ScopeTypeTypeACPower), }) + // if constraints are configured for acPower[id], set the + // constraint id and update measurementsConstraintData if acPowerConstraints[id] != nil { acPowerConstraints[id].MeasurementId = e.acPower[id] *measurementsConstraintData = append(*measurementsConstraintData, *acPowerConstraints[id]) @@ -301,6 +308,9 @@ func (e *MPC) configureMonitorEnergy( Unit: util.Ptr(model.UnitOfMeasurementTypeWh), ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), }) + + // if constraints are configured for acEnergyConsumed, set the + // constraint id and update measurementsConstraintData if e.energyConfig.ValueConstraintsConsumption != nil { e.energyConfig.ValueConstraintsConsumption.MeasurementId = e.acEnergyConsumed *measurementsConstraintData = append(*measurementsConstraintData, *e.energyConfig.ValueConstraintsConsumption) @@ -327,6 +337,8 @@ func (e *MPC) configureMonitorEnergy( ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), }) + // if constraints are configured for acEnergyProduced, set the + // constraint id and update measurementsConstraintData if e.energyConfig.ValueConstraintsProduction != nil { e.energyConfig.ValueConstraintsProduction.MeasurementId = e.acEnergyProduced *measurementsConstraintData = append(*measurementsConstraintData, *e.energyConfig.ValueConstraintsProduction) @@ -378,6 +390,8 @@ func (e *MPC) configureMonitorCurrent( ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), }) + // if constraints are configured for acCurrent[id], set the + // constraint id and update measurementsConstraintData if acCurrentConstraints[id] != nil { acCurrentConstraints[id].MeasurementId = e.acCurrent[id] *measurementsConstraintData = append(*measurementsConstraintData, *acCurrentConstraints[id]) @@ -441,6 +455,7 @@ func (e *MPC) configureMonitorVoltage( for id := 0; id < len(e.acVoltage); id++ { if e.powerConfig.SupportsPhases(phases[id]) { + // skip PhaseToPhase voltages if they're not supported if len(phases[id]) == 2 && !e.voltageConfig.SupportPhaseToPhase { continue } @@ -452,6 +467,8 @@ func (e *MPC) configureMonitorVoltage( ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), }) + // if constraints are configured for acVoltage[id], set the + // constraint id and update measurementsConstraintData if acVoltageConstraints[id] != nil { acVoltageConstraints[id].MeasurementId = e.acVoltage[id] *measurementsConstraintData = append(*measurementsConstraintData, *acVoltageConstraints[id]) @@ -494,6 +511,8 @@ func (e *MPC) configureMonitorFrequency( ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), }) + // if constraints are configured for acFrequency, set the + // constraint id and update measurementsConstraintData if e.frequencyConfig.ValueConstraints != nil { e.frequencyConfig.ValueConstraints.MeasurementId = e.acFrequency *measurementsConstraintData = append(*measurementsConstraintData, *e.frequencyConfig.ValueConstraints) From de32a669eaa13b3b43625f827d4e6512f7b983c8 Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Thu, 23 Oct 2025 14:09:19 +0200 Subject: [PATCH 20/61] Ensure that MuMPCInterface includes UseCaseInterface --- usecases/api/mu_mpc.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usecases/api/mu_mpc.go b/usecases/api/mu_mpc.go index b3e6a63a..80bc3f21 100644 --- a/usecases/api/mu_mpc.go +++ b/usecases/api/mu_mpc.go @@ -3,12 +3,14 @@ package api import ( "time" + "github.com/enbility/eebus-go/api" "github.com/enbility/spine-go/model" ) // Actor: Monitoring Unit // UseCase: Monitoring of Power Consumption type MuMPCInterface interface { + api.UseCaseInterface // ------------------------- Getters ------------------------- // // Scenario 1 From 86332c002fa457142b957ef868305336313e2cc6 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 11 Dec 2024 11:20:06 +0100 Subject: [PATCH 21/61] Delete unused variables in /usecases/mu/mpc/usecase_test.go and rename the suite to MuMpcUsecaseSuite. --- usecases/mu/mpc/usecase_test.go | 35 +++++---------------------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/usecases/mu/mpc/usecase_test.go b/usecases/mu/mpc/usecase_test.go index fb7404f3..61176280 100644 --- a/usecases/mu/mpc/usecase_test.go +++ b/usecases/mu/mpc/usecase_test.go @@ -10,7 +10,6 @@ import ( shipapi "github.com/enbility/ship-go/api" "github.com/enbility/ship-go/cert" spineapi "github.com/enbility/spine-go/api" - spinemocks "github.com/enbility/spine-go/mocks" "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/util" "github.com/stretchr/testify/assert" @@ -19,30 +18,19 @@ import ( ) func TestBasicSuite(t *testing.T) { - suite.Run(t, new(BasicSuite)) + suite.Run(t, new(MuMpcUsecaseSuite)) } -type BasicSuite struct { +type MuMpcUsecaseSuite struct { suite.Suite service api.ServiceInterface - - remoteDevice spineapi.DeviceRemoteInterface - mockRemoteEntity *spinemocks.EntityRemoteInterface - monitoredEntity spineapi.EntityRemoteInterface - loadControlFeature, - deviceDiagnosisFeature, - deviceConfigurationFeature spineapi.FeatureLocalInterface - - eventCalled bool } -func (s *BasicSuite) Event(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event api.EventType) { - s.eventCalled = true +func (s *MuMpcUsecaseSuite) Event(_ string, _ spineapi.DeviceRemoteInterface, _ spineapi.EntityRemoteInterface, _ api.EventType) { } -func (s *BasicSuite) BeforeTest(suiteName, testName string) { - s.eventCalled = false +func (s *MuMpcUsecaseSuite) BeforeTest(_, _ string) { cert, _ := cert.CreateCertificate("test", "test", "DE", "test") configuration, _ := api.NewConfiguration( "test", "test", "test", "test", @@ -56,22 +44,9 @@ func (s *BasicSuite) BeforeTest(suiteName, testName string) { s.service = service.NewService(configuration, serviceHandler) _ = s.service.Setup() - - mockRemoteDevice := spinemocks.NewDeviceRemoteInterface(s.T()) - s.mockRemoteEntity = spinemocks.NewEntityRemoteInterface(s.T()) - mockRemoteFeature := spinemocks.NewFeatureRemoteInterface(s.T()) - mockRemoteDevice.EXPECT().FeatureByEntityTypeAndRole(mock.Anything, mock.Anything, mock.Anything).Return(mockRemoteFeature).Maybe() - mockRemoteDevice.EXPECT().Ski().Return(remoteSki).Maybe() - s.mockRemoteEntity.EXPECT().Device().Return(mockRemoteDevice).Maybe() - s.mockRemoteEntity.EXPECT().EntityType().Return(mock.Anything).Maybe() - entityAddress := &model.EntityAddressType{} - s.mockRemoteEntity.EXPECT().Address().Return(entityAddress).Maybe() - mockRemoteFeature.EXPECT().DataCopy(mock.Anything).Return(mock.Anything).Maybe() - mockRemoteFeature.EXPECT().Address().Return(&model.FeatureAddressType{}).Maybe() - mockRemoteFeature.EXPECT().Operations().Return(nil).Maybe() } -func (s *BasicSuite) Test_MpcOptionalParameters() { +func (s *MuMpcUsecaseSuite) Test_MpcOptionalParameters() { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) // required From f0a6f1a11a65938746b45fa1bdacf99efbf55c3c Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 11 Dec 2024 11:28:12 +0100 Subject: [PATCH 22/61] Add comment for the GetOrAddIdForDescription in electricalConnection (server). --- features/server/electricalconnection.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/features/server/electricalconnection.go b/features/server/electricalconnection.go index 8cb84c2a..f9979a15 100644 --- a/features/server/electricalconnection.go +++ b/features/server/electricalconnection.go @@ -31,6 +31,11 @@ func NewElectricalConnection(localEntity spineapi.EntityLocalInterface) (*Electr return ec, nil } +// Get or add the id for a electrical connection with a given electricalConnectionDescription +// +// NOTE: This can be used instead of AddDescription to be sure it exists only one id for the same description +// +// will return the id for the electrical connection with the given description func (e *ElectricalConnection) GetOrAddIdForDescription( electricalConnectionDescription model.ElectricalConnectionDescriptionDataType, ) (*model.ElectricalConnectionIdType, error) { From 7809400f8b72aaece7449829dd6adbcf3ec3ecb7 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 11 Dec 2024 11:30:45 +0100 Subject: [PATCH 23/61] Return directly in GetOrAddIdForDescription if the id is found in the existing. --- features/server/electricalconnection.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/features/server/electricalconnection.go b/features/server/electricalconnection.go index f9979a15..3a37e5de 100644 --- a/features/server/electricalconnection.go +++ b/features/server/electricalconnection.go @@ -55,7 +55,7 @@ func (e *ElectricalConnection) GetOrAddIdForDescription( description.Label == electricalConnectionDescription.Label && description.Description == electricalConnectionDescription.Description { electricalConnectionId = description.ElectricalConnectionId - break + return electricalConnectionId, nil } else if description.ElectricalConnectionId != nil { if *description.ElectricalConnectionId > highestExistingElectricalConnectionId { highestExistingElectricalConnectionId = *description.ElectricalConnectionId @@ -64,15 +64,13 @@ func (e *ElectricalConnection) GetOrAddIdForDescription( } } - if electricalConnectionId == nil { - electricalConnectionId = util.Ptr(highestExistingElectricalConnectionId + 1) - description := electricalConnectionDescription - description.ElectricalConnectionId = electricalConnectionId - if errType := e.featureLocal.UpdateData(model.FunctionTypeElectricalConnectionDescriptionListData, &model.ElectricalConnectionDescriptionListDataType{ - ElectricalConnectionDescriptionData: []model.ElectricalConnectionDescriptionDataType{description}, - }, model.NewFilterTypePartial(), nil); errType != nil { - return nil, errors.New("could not add description data") - } + electricalConnectionId = util.Ptr(highestExistingElectricalConnectionId + 1) + description := electricalConnectionDescription + description.ElectricalConnectionId = electricalConnectionId + if errType := e.featureLocal.UpdateData(model.FunctionTypeElectricalConnectionDescriptionListData, &model.ElectricalConnectionDescriptionListDataType{ + ElectricalConnectionDescriptionData: []model.ElectricalConnectionDescriptionDataType{description}, + }, model.NewFilterTypePartial(), nil); errType != nil { + return nil, errors.New("could not add description data") } return electricalConnectionId, nil From f8138e92d60964e90eaf9b1b50ff98089c58ff77 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 11 Dec 2024 14:17:37 +0100 Subject: [PATCH 24/61] Make AddFeatures methods consistent and check if the features do exist. --- usecases/cem/cevc/usecase.go | 5 +- usecases/cem/evcc/usecase.go | 4 + usecases/cem/evcem/usecase.go | 5 +- usecases/cem/evsecc/usecase.go | 5 +- usecases/cem/evsoc/usecase.go | 5 +- usecases/cem/opev/usecase.go | 8 +- usecases/cem/oscev/usecase.go | 9 +- usecases/cem/vabd/usecase.go | 5 +- usecases/cem/vapd/usecase.go | 5 +- usecases/cs/lpc/usecase.go | 169 +++++++++++++++++--------------- usecases/cs/lpp/usecase.go | 172 +++++++++++++++++---------------- usecases/eg/lpc/usecase.go | 8 +- usecases/eg/lpp/usecase.go | 8 +- usecases/ma/mgcp/usecase.go | 5 +- usecases/ma/mpc/usecase.go | 5 +- usecases/mu/mpc/usecase.go | 6 ++ 16 files changed, 251 insertions(+), 173 deletions(-) diff --git a/usecases/cem/cevc/usecase.go b/usecases/cem/cevc/usecase.go index b5c88682..685212b8 100644 --- a/usecases/cem/cevc/usecase.go +++ b/usecases/cem/cevc/usecase.go @@ -1,6 +1,7 @@ package cevc import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/eebus-go/usecases/usecase" @@ -90,7 +91,9 @@ func (e *CEVC) AddFeatures() error { model.FeatureTypeTypeElectricalConnection, } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("failed to add feature: " + string(feature)) + } } // server features diff --git a/usecases/cem/evcc/usecase.go b/usecases/cem/evcc/usecase.go index 89f1c874..8f8461c7 100644 --- a/usecases/cem/evcc/usecase.go +++ b/usecases/cem/evcc/usecase.go @@ -1,6 +1,7 @@ package evcc import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/eebus-go/usecases/usecase" @@ -106,6 +107,9 @@ func (e *EVCC) AddFeatures() error { } for _, feature := range clientFeatures { f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f == nil { + return errors.New("could not add feature: " + string(feature)) + } f.AddResultCallback(e.HandleResponse) } diff --git a/usecases/cem/evcem/usecase.go b/usecases/cem/evcem/usecase.go index 9d42ed48..696230e2 100644 --- a/usecases/cem/evcem/usecase.go +++ b/usecases/cem/evcem/usecase.go @@ -1,6 +1,7 @@ package evcem import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" usecase "github.com/enbility/eebus-go/usecases/usecase" @@ -89,7 +90,9 @@ func (e *EVCEM) AddFeatures() error { model.FeatureTypeTypeMeasurement, } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("failed to add feature: " + string(feature)) + } } return nil diff --git a/usecases/cem/evsecc/usecase.go b/usecases/cem/evsecc/usecase.go index 9e459ce1..1df087af 100644 --- a/usecases/cem/evsecc/usecase.go +++ b/usecases/cem/evsecc/usecase.go @@ -1,6 +1,7 @@ package evsecc import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/eebus-go/usecases/usecase" @@ -71,7 +72,9 @@ func (e *EVSECC) AddFeatures() error { } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("could not add feature: " + string(feature)) + } } return nil diff --git a/usecases/cem/evsoc/usecase.go b/usecases/cem/evsoc/usecase.go index 3c9b73b8..55c241d9 100644 --- a/usecases/cem/evsoc/usecase.go +++ b/usecases/cem/evsoc/usecase.go @@ -1,6 +1,7 @@ package evsoc import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" usecase "github.com/enbility/eebus-go/usecases/usecase" @@ -65,7 +66,9 @@ func (e *EVSOC) AddFeatures() error { model.FeatureTypeTypeMeasurement, } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("could not add feature: " + string(feature)) + } } return nil diff --git a/usecases/cem/opev/usecase.go b/usecases/cem/opev/usecase.go index 1e06abb5..185fa5a4 100644 --- a/usecases/cem/opev/usecase.go +++ b/usecases/cem/opev/usecase.go @@ -1,6 +1,7 @@ package opev import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/eebus-go/usecases/usecase" @@ -76,11 +77,16 @@ func (e *OPEV) AddFeatures() error { model.FeatureTypeTypeElectricalConnection, } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("could not add feature: " + string(feature)) + } } // server features f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeServer) + if f == nil { + return errors.New("could not add feature: " + string(model.FeatureTypeTypeDeviceDiagnosis)) + } f.AddFunctionType(model.FunctionTypeDeviceDiagnosisStateData, true, false) f.AddFunctionType(model.FunctionTypeDeviceDiagnosisHeartbeatData, true, false) diff --git a/usecases/cem/oscev/usecase.go b/usecases/cem/oscev/usecase.go index 0aa2ba08..8befa8da 100644 --- a/usecases/cem/oscev/usecase.go +++ b/usecases/cem/oscev/usecase.go @@ -1,6 +1,7 @@ package oscev import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/eebus-go/usecases/usecase" @@ -76,11 +77,17 @@ func (e *OSCEV) AddFeatures() error { model.FeatureTypeTypeElectricalConnection, } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("could not add feature: " + string(feature)) + } } // server features f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeServer) + if f == nil { + return errors.New("could not add feature: " + string(model.FeatureTypeTypeDeviceDiagnosis)) + } + f.AddFunctionType(model.FunctionTypeDeviceDiagnosisStateData, true, false) f.AddFunctionType(model.FunctionTypeDeviceDiagnosisHeartbeatData, true, false) diff --git a/usecases/cem/vabd/usecase.go b/usecases/cem/vabd/usecase.go index 2fd4e022..6ae5dc33 100644 --- a/usecases/cem/vabd/usecase.go +++ b/usecases/cem/vabd/usecase.go @@ -1,6 +1,7 @@ package vabd import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/eebus-go/usecases/usecase" @@ -91,7 +92,9 @@ func (e *VABD) AddFeatures() error { model.FeatureTypeTypeMeasurement, } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("could not add feature: " + string(feature)) + } } return nil diff --git a/usecases/cem/vapd/usecase.go b/usecases/cem/vapd/usecase.go index 6cae541c..da3cd3a3 100644 --- a/usecases/cem/vapd/usecase.go +++ b/usecases/cem/vapd/usecase.go @@ -1,6 +1,7 @@ package vapd import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/eebus-go/usecases/usecase" @@ -82,7 +83,9 @@ func (e *VAPD) AddFeatures() error { model.FeatureTypeTypeMeasurement, } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("could not add feature: " + string(feature)) + } } return nil diff --git a/usecases/cs/lpc/usecase.go b/usecases/cs/lpc/usecase.go index 612588f9..c964a9e0 100644 --- a/usecases/cs/lpc/usecase.go +++ b/usecases/cs/lpc/usecase.go @@ -1,6 +1,7 @@ package lpc import ( + "errors" "sync" "github.com/enbility/eebus-go/api" @@ -228,14 +229,19 @@ func (e *LPC) deviceConfigurationWriteCB(msg *spineapi.Message) { func (e *LPC) AddFeatures() error { // client features - _ = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeClient); f == nil { + return errors.New("feature not found: DeviceDiagnosis") + } // server features f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeLoadControl, model.RoleTypeServer) + if f == nil { + return errors.New("feature not found: LoadControl") + } + f.AddFunctionType(model.FunctionTypeLoadControlLimitDescriptionListData, true, false) f.AddFunctionType(model.FunctionTypeLoadControlLimitListData, true, true) - err := f.AddWriteApprovalCallback(e.loadControlWriteCB) - if err != nil { + if err := f.AddWriteApprovalCallback(e.loadControlWriteCB); err != nil { return err } @@ -248,21 +254,25 @@ func (e *LPC) AddFeatures() error { Unit: util.Ptr(model.UnitOfMeasurementTypeW), ScopeType: util.Ptr(model.ScopeTypeTypeActivePowerLimit), } - if lc, err := server.NewLoadControl(e.LocalEntity); err == nil { - limitId := lc.AddLimitDescription(newLimitDesc) - - newLimiData := []api.LoadControlLimitDataForID{ - { - Data: model.LoadControlLimitDataType{ - Value: model.NewScaledNumberType(0), - IsLimitChangeable: util.Ptr(true), - IsLimitActive: util.Ptr(false), - }, - Id: *limitId, + + lc, err := server.NewLoadControl(e.LocalEntity) + if err != nil { + return err + } + + limitId := lc.AddLimitDescription(newLimitDesc) + + newLimiData := []api.LoadControlLimitDataForID{ + { + Data: model.LoadControlLimitDataType{ + Value: model.NewScaledNumberType(0), + IsLimitChangeable: util.Ptr(true), + IsLimitActive: util.Ptr(false), }, - } - _ = lc.UpdateLimitDataForIds(newLimiData) - } else { + Id: *limitId, + }, + } + if err := lc.UpdateLimitDataForIds(newLimiData); err != nil { return err } @@ -271,62 +281,61 @@ func (e *LPC) AddFeatures() error { f.AddFunctionType(model.FunctionTypeDeviceConfigurationKeyValueListData, true, true) _ = f.AddWriteApprovalCallback(e.deviceConfigurationWriteCB) - if dcs, err := server.NewDeviceConfiguration(e.LocalEntity); err == nil { - dcs.AddKeyValueDescription( - model.DeviceConfigurationKeyValueDescriptionDataType{ - KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeConsumptionActivePowerLimit), - ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeScaledNumber), - Unit: util.Ptr(model.UnitOfMeasurementTypeW), - }, - ) + dcs, err := server.NewDeviceConfiguration(e.LocalEntity) + if err != nil { + return err + } - // only add if it doesn't exist yet - filter := model.DeviceConfigurationKeyValueDescriptionDataType{ - KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), - } - if data, err := dcs.GetKeyValueDescriptionsForFilter(filter); err == nil && len(data) == 0 { - dcs.AddKeyValueDescription( - model.DeviceConfigurationKeyValueDescriptionDataType{ - KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), - ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeDuration), - }, - ) - } + dcs.AddKeyValueDescription( + model.DeviceConfigurationKeyValueDescriptionDataType{ + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeConsumptionActivePowerLimit), + ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeScaledNumber), + Unit: util.Ptr(model.UnitOfMeasurementTypeW), + }, + ) - value := &model.DeviceConfigurationKeyValueValueType{ - ScaledNumber: model.NewScaledNumberType(0), - } - err1 := dcs.UpdateKeyValueDataForFilter( - model.DeviceConfigurationKeyValueDataType{ - Value: value, - IsValueChangeable: util.Ptr(true), - }, - nil, + // only add if it doesn't exist yet + filter := model.DeviceConfigurationKeyValueDescriptionDataType{ + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), + } + if data, err := dcs.GetKeyValueDescriptionsForFilter(filter); err == nil && len(data) == 0 { + dcs.AddKeyValueDescription( model.DeviceConfigurationKeyValueDescriptionDataType{ - KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeConsumptionActivePowerLimit), + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), + ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeDuration), }, ) - if err1 != nil { - return err1 - } + } - value = &model.DeviceConfigurationKeyValueValueType{ - Duration: model.NewDurationType(0), - } - err1 = dcs.UpdateKeyValueDataForFilter( - model.DeviceConfigurationKeyValueDataType{ - Value: value, - IsValueChangeable: util.Ptr(true), - }, - nil, - model.DeviceConfigurationKeyValueDescriptionDataType{ - KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), - }, - ) - if err1 != nil { - return err1 - } - } else { + value := &model.DeviceConfigurationKeyValueValueType{ + ScaledNumber: model.NewScaledNumberType(0), + } + if err := dcs.UpdateKeyValueDataForFilter( + model.DeviceConfigurationKeyValueDataType{ + Value: value, + IsValueChangeable: util.Ptr(true), + }, + nil, + model.DeviceConfigurationKeyValueDescriptionDataType{ + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeConsumptionActivePowerLimit), + }, + ); err != nil { + return err + } + + value = &model.DeviceConfigurationKeyValueValueType{ + Duration: model.NewDurationType(0), + } + if err := dcs.UpdateKeyValueDataForFilter( + model.DeviceConfigurationKeyValueDataType{ + Value: value, + IsValueChangeable: util.Ptr(true), + }, + nil, + model.DeviceConfigurationKeyValueDescriptionDataType{ + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), + }, + ); err != nil { return err } @@ -336,18 +345,20 @@ func (e *LPC) AddFeatures() error { f = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) f.AddFunctionType(model.FunctionTypeElectricalConnectionCharacteristicListData, true, false) - if ec, err := server.NewElectricalConnection(e.LocalEntity); err == nil { - electricalConnectionId := internal.GetElectricalConnectionId(e.LocalEntity) - parameterId := internal.GetParameterIdForACPowerTotalMeasurement(e.LocalEntity, electricalConnectionId, measurementId) - newCharData := model.ElectricalConnectionCharacteristicDataType{ - ElectricalConnectionId: util.Ptr(electricalConnectionId), - ParameterId: util.Ptr(parameterId), - CharacteristicContext: util.Ptr(model.ElectricalConnectionCharacteristicContextTypeEntity), - CharacteristicType: util.Ptr(e.characteristicType()), - Unit: util.Ptr(model.UnitOfMeasurementTypeW), - } - _, _ = ec.AddCharacteristic(newCharData) - } else { + ec, err := server.NewElectricalConnection(e.LocalEntity) + if err != nil { + return err + } + electricalConnectionId := internal.GetElectricalConnectionId(e.LocalEntity) + parameterId := internal.GetParameterIdForACPowerTotalMeasurement(e.LocalEntity, electricalConnectionId, measurementId) + newCharData := model.ElectricalConnectionCharacteristicDataType{ + ElectricalConnectionId: util.Ptr(electricalConnectionId), + ParameterId: util.Ptr(parameterId), + CharacteristicContext: util.Ptr(model.ElectricalConnectionCharacteristicContextTypeEntity), + CharacteristicType: util.Ptr(e.characteristicType()), + Unit: util.Ptr(model.UnitOfMeasurementTypeW), + } + if _, err := ec.AddCharacteristic(newCharData); err != nil { return err } diff --git a/usecases/cs/lpp/usecase.go b/usecases/cs/lpp/usecase.go index 24d9005c..b36a4e21 100644 --- a/usecases/cs/lpp/usecase.go +++ b/usecases/cs/lpp/usecase.go @@ -1,6 +1,7 @@ package lpp import ( + "errors" "sync" "github.com/enbility/eebus-go/api" @@ -228,14 +229,18 @@ func (e *LPP) deviceConfigurationWriteCB(msg *spineapi.Message) { func (e *LPP) AddFeatures() error { // client features - _ = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeClient); f == nil { + return errors.New("could not add feature: " + string(model.FeatureTypeTypeDeviceDiagnosis)) + } // server features f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeLoadControl, model.RoleTypeServer) + if f == nil { + return errors.New("could not add feature: " + string(model.FeatureTypeTypeLoadControl)) + } f.AddFunctionType(model.FunctionTypeLoadControlLimitDescriptionListData, true, false) f.AddFunctionType(model.FunctionTypeLoadControlLimitListData, true, true) - err := f.AddWriteApprovalCallback(e.loadControlWriteCB) - if err != nil { + if err := f.AddWriteApprovalCallback(e.loadControlWriteCB); err != nil { return err } @@ -248,21 +253,25 @@ func (e *LPP) AddFeatures() error { Unit: util.Ptr(model.UnitOfMeasurementTypeW), ScopeType: util.Ptr(model.ScopeTypeTypeActivePowerLimit), } - if lc, err := server.NewLoadControl(e.LocalEntity); err == nil { - limitId := lc.AddLimitDescription(newLimitDesc) - - newLimiData := []api.LoadControlLimitDataForID{ - { - Data: model.LoadControlLimitDataType{ - Value: model.NewScaledNumberType(0), - IsLimitChangeable: util.Ptr(true), - IsLimitActive: util.Ptr(false), - }, - Id: *limitId, + + lc, err := server.NewLoadControl(e.LocalEntity) + if err != nil { + return err + } + + limitId := lc.AddLimitDescription(newLimitDesc) + + newLimiData := []api.LoadControlLimitDataForID{ + { + Data: model.LoadControlLimitDataType{ + Value: model.NewScaledNumberType(0), + IsLimitChangeable: util.Ptr(true), + IsLimitActive: util.Ptr(false), }, - } - _ = lc.UpdateLimitDataForIds(newLimiData) - } else { + Id: *limitId, + }, + } + if err = lc.UpdateLimitDataForIds(newLimiData); err != nil { return err } @@ -271,62 +280,61 @@ func (e *LPP) AddFeatures() error { f.AddFunctionType(model.FunctionTypeDeviceConfigurationKeyValueListData, true, true) _ = f.AddWriteApprovalCallback(e.deviceConfigurationWriteCB) - if dcs, err := server.NewDeviceConfiguration(e.LocalEntity); err == nil { - dcs.AddKeyValueDescription( - model.DeviceConfigurationKeyValueDescriptionDataType{ - KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeProductionActivePowerLimit), - ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeScaledNumber), - Unit: util.Ptr(model.UnitOfMeasurementTypeW), - }, - ) + dcs, err := server.NewDeviceConfiguration(e.LocalEntity) + if err != nil { + return err + } - // only add if it doesn't exist yet - filter := model.DeviceConfigurationKeyValueDescriptionDataType{ - KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), - } - if data, err := dcs.GetKeyValueDescriptionsForFilter(filter); err == nil && len(data) == 0 { - dcs.AddKeyValueDescription( - model.DeviceConfigurationKeyValueDescriptionDataType{ - KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), - ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeDuration), - }, - ) - } + dcs.AddKeyValueDescription( + model.DeviceConfigurationKeyValueDescriptionDataType{ + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeProductionActivePowerLimit), + ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeScaledNumber), + Unit: util.Ptr(model.UnitOfMeasurementTypeW), + }, + ) - value := &model.DeviceConfigurationKeyValueValueType{ - ScaledNumber: model.NewScaledNumberType(0), - } - err1 := dcs.UpdateKeyValueDataForFilter( - model.DeviceConfigurationKeyValueDataType{ - Value: value, - IsValueChangeable: util.Ptr(true), - }, - nil, + // only add if it doesn't exist yet + filter := model.DeviceConfigurationKeyValueDescriptionDataType{ + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), + } + if data, err := dcs.GetKeyValueDescriptionsForFilter(filter); err == nil && len(data) == 0 { + dcs.AddKeyValueDescription( model.DeviceConfigurationKeyValueDescriptionDataType{ - KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeProductionActivePowerLimit), + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), + ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeDuration), }, ) - if err1 != nil { - return err1 - } + } - value = &model.DeviceConfigurationKeyValueValueType{ - Duration: model.NewDurationType(0), - } - err1 = dcs.UpdateKeyValueDataForFilter( - model.DeviceConfigurationKeyValueDataType{ - Value: value, - IsValueChangeable: util.Ptr(true), - }, - nil, - model.DeviceConfigurationKeyValueDescriptionDataType{ - KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), - }, - ) - if err1 != nil { - return err1 - } - } else { + value := &model.DeviceConfigurationKeyValueValueType{ + ScaledNumber: model.NewScaledNumberType(0), + } + if err := dcs.UpdateKeyValueDataForFilter( + model.DeviceConfigurationKeyValueDataType{ + Value: value, + IsValueChangeable: util.Ptr(true), + }, + nil, + model.DeviceConfigurationKeyValueDescriptionDataType{ + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeProductionActivePowerLimit), + }, + ); err != nil { + return err + } + + value = &model.DeviceConfigurationKeyValueValueType{ + Duration: model.NewDurationType(0), + } + if err := dcs.UpdateKeyValueDataForFilter( + model.DeviceConfigurationKeyValueDataType{ + Value: value, + IsValueChangeable: util.Ptr(true), + }, + nil, + model.DeviceConfigurationKeyValueDescriptionDataType{ + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypeFailsafeDurationMinimum), + }, + ); err != nil { return err } @@ -336,21 +344,21 @@ func (e *LPP) AddFeatures() error { f = e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) f.AddFunctionType(model.FunctionTypeElectricalConnectionCharacteristicListData, true, false) - if ec, err := server.NewElectricalConnection(e.LocalEntity); err == nil { - electricalConnectionId := internal.GetElectricalConnectionId(e.LocalEntity) - parameterId := internal.GetParameterIdForACPowerTotalMeasurement(e.LocalEntity, electricalConnectionId, measurementId) - newCharData := model.ElectricalConnectionCharacteristicDataType{ - ElectricalConnectionId: util.Ptr(electricalConnectionId), - ParameterId: util.Ptr(parameterId), - CharacteristicContext: util.Ptr(model.ElectricalConnectionCharacteristicContextTypeEntity), - CharacteristicType: util.Ptr(e.characteristicType()), - Unit: util.Ptr(model.UnitOfMeasurementTypeW), - } - _, err1 := ec.AddCharacteristic(newCharData) - if err1 != nil { - return err1 - } - } else { + ec, err := server.NewElectricalConnection(e.LocalEntity) + if err != nil { + return err + } + + electricalConnectionId := internal.GetElectricalConnectionId(e.LocalEntity) + parameterId := internal.GetParameterIdForACPowerTotalMeasurement(e.LocalEntity, electricalConnectionId, measurementId) + newCharData := model.ElectricalConnectionCharacteristicDataType{ + ElectricalConnectionId: util.Ptr(electricalConnectionId), + ParameterId: util.Ptr(parameterId), + CharacteristicContext: util.Ptr(model.ElectricalConnectionCharacteristicContextTypeEntity), + CharacteristicType: util.Ptr(e.characteristicType()), + Unit: util.Ptr(model.UnitOfMeasurementTypeW), + } + if _, err := ec.AddCharacteristic(newCharData); err != nil { return err } diff --git a/usecases/eg/lpc/usecase.go b/usecases/eg/lpc/usecase.go index bec522fc..2a19f484 100644 --- a/usecases/eg/lpc/usecase.go +++ b/usecases/eg/lpc/usecase.go @@ -1,6 +1,7 @@ package lpc import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" usecase "github.com/enbility/eebus-go/usecases/usecase" @@ -86,11 +87,16 @@ func (e *LPC) AddFeatures() error { model.FeatureTypeTypeElectricalConnection, } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("could not add feature: " + string(feature)) + } } // server features f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeServer) + if f == nil { + return errors.New("could not add feature: " + string(model.FeatureTypeTypeDeviceDiagnosis)) + } f.AddFunctionType(model.FunctionTypeDeviceDiagnosisHeartbeatData, true, false) return nil diff --git a/usecases/eg/lpp/usecase.go b/usecases/eg/lpp/usecase.go index 368f871c..007c0be1 100644 --- a/usecases/eg/lpp/usecase.go +++ b/usecases/eg/lpp/usecase.go @@ -1,6 +1,7 @@ package lpp import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/eebus-go/usecases/usecase" @@ -84,11 +85,16 @@ func (e *LPP) AddFeatures() error { model.FeatureTypeTypeElectricalConnection, } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("could not add feature: " + string(feature)) + } } // server features f := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceDiagnosis, model.RoleTypeServer) + if f == nil { + return errors.New("could not add feature: " + string(model.FeatureTypeTypeDeviceDiagnosis)) + } f.AddFunctionType(model.FunctionTypeDeviceDiagnosisHeartbeatData, true, false) return nil diff --git a/usecases/ma/mgcp/usecase.go b/usecases/ma/mgcp/usecase.go index 5d3c97fb..5df0400d 100644 --- a/usecases/ma/mgcp/usecase.go +++ b/usecases/ma/mgcp/usecase.go @@ -1,6 +1,7 @@ package mgcp import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" usecase "github.com/enbility/eebus-go/usecases/usecase" @@ -113,7 +114,9 @@ func (e *MGCP) AddFeatures() error { model.FeatureTypeTypeMeasurement, } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("could not add feature: " + string(feature)) + } } return nil diff --git a/usecases/ma/mpc/usecase.go b/usecases/ma/mpc/usecase.go index ff3917b2..abc4d911 100644 --- a/usecases/ma/mpc/usecase.go +++ b/usecases/ma/mpc/usecase.go @@ -1,6 +1,7 @@ package mpc import ( + "errors" "github.com/enbility/eebus-go/api" ucapi "github.com/enbility/eebus-go/usecases/api" usecase "github.com/enbility/eebus-go/usecases/usecase" @@ -104,7 +105,9 @@ func (e *MPC) AddFeatures() error { model.FeatureTypeTypeMeasurement, } for _, feature := range clientFeatures { - _ = e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient) + if f := e.LocalEntity.GetOrAddFeature(feature, model.RoleTypeClient); f == nil { + return errors.New("failed to add feature: " + string(feature)) + } } return nil diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index e2b1a3d9..15f98c86 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -143,10 +143,16 @@ func NewMPC( func (e *MPC) AddFeatures() error { // server features electricalConnectionFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) + if electricalConnectionFeature == nil { + return errors.New("could not add feature: " + string(model.FeatureTypeTypeElectricalConnection)) + } electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionDescriptionListData, true, false) electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionParameterDescriptionListData, true, false) measurementFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) + if measurementFeature == nil { + return errors.New("could not add feature: " + string(model.FeatureTypeTypeMeasurement)) + } measurementFeature.AddFunctionType(model.FunctionTypeMeasurementDescriptionListData, true, false) measurementFeature.AddFunctionType(model.FunctionTypeMeasurementConstraintsListData, true, false) measurementFeature.AddFunctionType(model.FunctionTypeMeasurementListData, true, false) From 7fd53c894823bf73909adcdfec37e97500189c6e Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 11 Dec 2024 14:39:59 +0100 Subject: [PATCH 25/61] Add usecase tests --- usecases/mu/mpc/usecase_test.go | 42 ++++++++++++++++++++++++++++++++ usecases/usecase/usecase_test.go | 4 +++ 2 files changed, 46 insertions(+) diff --git a/usecases/mu/mpc/usecase_test.go b/usecases/mu/mpc/usecase_test.go index 61176280..49629bb7 100644 --- a/usecases/mu/mpc/usecase_test.go +++ b/usecases/mu/mpc/usecase_test.go @@ -125,3 +125,45 @@ func (s *MuMpcUsecaseSuite) Test_MpcOptionalParameters() { mpc.AddUseCase() } } + +func (s *MuMpcUsecaseSuite) Test_getMeasurementDataForId() { + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + + monitorPowerConfig := MonitorPowerConfig{ + ConnectedPhases: ConnectedPhasesABC, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + mpc, err := NewMPC( + localEntity, + s.Event, + &monitorPowerConfig, + nil, + nil, + nil, + nil, + ) + assert.Nil(s.T(), err) + + _, err = mpc.getMeasurementDataForId(mpc.acPowerTotal) + assert.NotNil(s.T(), err) + + err = mpc.AddFeatures() + assert.Nil(s.T(), err) + mpc.AddUseCase() + + _, err = mpc.getMeasurementDataForId(mpc.acPowerTotal) + assert.NotNil(s.T(), err) + + err = mpc.Update( + mpc.UpdateDataPowerTotal(5.0, util.Ptr(time.Now()), nil), + ) + assert.Nil(s.T(), err) + + measurementData, err := mpc.getMeasurementDataForId(mpc.acPowerTotal) + assert.Nil(s.T(), err) + assert.NotNil(s.T(), measurementData) +} diff --git a/usecases/usecase/usecase_test.go b/usecases/usecase/usecase_test.go index 58a4a524..299963f2 100644 --- a/usecases/usecase/usecase_test.go +++ b/usecases/usecase/usecase_test.go @@ -23,6 +23,10 @@ func (s *UseCaseSuite) Test() { result = s.uc.IsCompatibleEntityType(payload.Entity) assert.True(s.T(), result) + s.uc.allEntityTypesValid = true + result = s.uc.IsCompatibleEntityType(payload.Entity) + assert.True(s.T(), result) + usecaseFilter := model.UseCaseFilterType{ Actor: useCaseActor, UseCaseName: useCaseName, From 55a4b3e78e29cf9dc97fa1e73742f3bbbd05f05e Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 11 Dec 2024 14:48:21 +0100 Subject: [PATCH 26/61] Simplify mpc/public --- usecases/mu/mpc/public.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usecases/mu/mpc/public.go b/usecases/mu/mpc/public.go index 7e1e05f5..2f2d003c 100644 --- a/usecases/mu/mpc/public.go +++ b/usecases/mu/mpc/public.go @@ -168,9 +168,9 @@ func (e *MPC) Update(updateData ...usecaseapi.UpdateMeasurementData) error { for _, measurementDataForId := range updateData { if !measurementDataForId.Supported() { return measurementDataForId.NotSupportedError() - } else { - measurementDataForIds = append(measurementDataForIds, measurementDataForId.MeasurementData()) } + + measurementDataForIds = append(measurementDataForIds, measurementDataForId.MeasurementData()) } return measurements.UpdateDataForIds(measurementDataForIds) From 2533a5084b6f301216c796eaa07c82fbeb80022e Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Thu, 12 Dec 2024 15:26:03 +0100 Subject: [PATCH 27/61] Add simple testcases for private functions and error cases from AddFeatures(). --- usecases/mu/mpc/usecase.go | 15 +- usecases/mu/mpc/usecase_test.go | 366 ++++++++++++++++++++++++++++++++ 2 files changed, 373 insertions(+), 8 deletions(-) diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index 15f98c86..7ea62249 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -179,7 +179,7 @@ func (e *MPC) AddFeatures() error { configMethods := []func( measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error{ @@ -212,7 +212,7 @@ func (e *MPC) AddFeatures() error { func (e *MPC) configureMonitorPower( measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { @@ -287,8 +287,7 @@ func (e *MPC) configureMonitorPower( AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), } - parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) - if parameterDescriptionId == nil { + if electricalConnection.AddParameterDescription(parameterDescription) == nil { return errors.New("could not add parameter description") } } @@ -299,7 +298,7 @@ func (e *MPC) configureMonitorPower( func (e *MPC) configureMonitorEnergy( measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { @@ -367,7 +366,7 @@ func (e *MPC) configureMonitorEnergy( func (e *MPC) configureMonitorCurrent( measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { @@ -424,7 +423,7 @@ func (e *MPC) configureMonitorCurrent( func (e *MPC) configureMonitorVoltage( measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { @@ -502,7 +501,7 @@ func (e *MPC) configureMonitorVoltage( func (e *MPC) configureMonitorFrequency( measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { diff --git a/usecases/mu/mpc/usecase_test.go b/usecases/mu/mpc/usecase_test.go index 49629bb7..4b1b3343 100644 --- a/usecases/mu/mpc/usecase_test.go +++ b/usecases/mu/mpc/usecase_test.go @@ -1,6 +1,8 @@ package mpc import ( + "github.com/enbility/eebus-go/features/server" + spinemocks "github.com/enbility/spine-go/mocks" "testing" "time" @@ -167,3 +169,367 @@ func (s *MuMpcUsecaseSuite) Test_getMeasurementDataForId() { assert.Nil(s.T(), err) assert.NotNil(s.T(), measurementData) } + +func (s *MuMpcAbcSuite) Test_AddFeatures_ElectricalFeatureNilError() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + s.sut.LocalEntity = localEntity + + localEntity.EXPECT().GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer).Return(nil) + err := s.sut.AddFeatures() + assert.NotNil(s.T(), err) +} + +func (s *MuMpcAbcSuite) Test_AddFeatures_MeasurementFeatureNilError() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + s.sut.LocalEntity = localEntity + + anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().AddFunctionType(mock.Anything, mock.Anything, mock.Anything).Return() + + localEntity.EXPECT().GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer).Return(anyFeature) + localEntity.EXPECT().GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer).Return(nil) + + err := s.sut.AddFeatures() + assert.NotNil(s.T(), err) +} + +func (s *MuMpcAbcSuite) Test_AddFeatures_NewMeasurementsError() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + s.sut.LocalEntity = localEntity + + anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().AddFunctionType(mock.Anything, mock.Anything, mock.Anything).Return() + + localEntity.EXPECT().GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer).Return(anyFeature) + localEntity.EXPECT().GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer).Return(anyFeature) + + localEntity.EXPECT().Device().Return(nil) + localEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeMeasurement, model.RoleTypeServer).Return(nil) + + err := s.sut.AddFeatures() + assert.NotNil(s.T(), err) +} + +func (s *MuMpcAbcSuite) Test_AddFeatures_NewElectricalConnectionError() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + s.sut.LocalEntity = localEntity + + anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().AddFunctionType(mock.Anything, mock.Anything, mock.Anything).Return() + + localEntity.EXPECT().GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer).Return(anyFeature) + localEntity.EXPECT().GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer).Return(anyFeature) + + localEntity.EXPECT().Device().Return(nil) + localEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeMeasurement, model.RoleTypeServer).Return(anyFeature) + localEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer).Return(nil) + + err := s.sut.AddFeatures() + assert.NotNil(s.T(), err) +} + +func (s *MuMpcUsecaseSuite) Test_configureMonitorPower() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity.EXPECT().Device().Return(nil) + + anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) + anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + + localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature) + + monitorPowerConfig := MonitorPowerConfig{ + ConnectedPhases: ConnectedPhasesABC, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + mpc, err := NewMPC( + localEntity, + s.Event, + &monitorPowerConfig, + nil, + nil, + nil, + nil, + ) + assert.Nil(s.T(), err) + + measurements, err := server.NewMeasurement(localEntity) + assert.Nil(s.T(), err) + + var electricalConnection api.ElectricalConnectionServerInterface + electricalConnection, err = server.NewElectricalConnection(localEntity) + assert.Nil(s.T(), err) + + electricalConnectionId := model.ElectricalConnectionIdType(111) + constraints := make([]model.MeasurementConstraintsDataType, 0) + + mpc.powerConfig = nil + err = mpc.configureMonitorPower( + measurements, + electricalConnection, + &electricalConnectionId, + &constraints, + ) + assert.NotNil(s.T(), err) // no monitorPowerConfig + + mpc.powerConfig = &monitorPowerConfig + electricalConnection = mocks.NewElectricalConnectionServerInterface(s.T()) + electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil) + + err = mpc.configureMonitorPower( + measurements, + electricalConnection, + &electricalConnectionId, + nil, + ) + + assert.NotNil(s.T(), err) // could not add parameter description TODO + + electricalConnection, err = server.NewElectricalConnection(localEntity) + assert.Nil(s.T(), err) +} + +func (s *MuMpcUsecaseSuite) Test_configureMonitorEnergy() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity.EXPECT().Device().Return(nil) + + anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) + anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + + localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature) + + monitorPowerConfig := MonitorPowerConfig{ + ConnectedPhases: ConnectedPhasesABC, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + monitorEnergyConfig := MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + mpc, err := NewMPC( + localEntity, + s.Event, + &monitorPowerConfig, + &monitorEnergyConfig, + nil, + nil, + nil, + ) + assert.Nil(s.T(), err) + + measurements, err := server.NewMeasurement(localEntity) + assert.Nil(s.T(), err) + + var electricalConnection api.ElectricalConnectionServerInterface + electricalConnection, err = server.NewElectricalConnection(localEntity) + assert.Nil(s.T(), err) + + electricalConnectionId := model.ElectricalConnectionIdType(111) + constraints := make([]model.MeasurementConstraintsDataType, 0) + electricalConnection = mocks.NewElectricalConnectionServerInterface(s.T()) + electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil) + + err = mpc.configureMonitorEnergy( + measurements, + electricalConnection, + &electricalConnectionId, + &constraints, + ) + + assert.NotNil(s.T(), err) // could not add parameter description 1 + mpc.energyConfig.ValueConstraintsConsumption = nil + + err = mpc.configureMonitorEnergy( + measurements, + electricalConnection, + &electricalConnectionId, + &constraints, + ) + + assert.NotNil(s.T(), err) // could not add parameter description 2 +} + +func (s *MuMpcUsecaseSuite) Test_configureMonitorCurrent() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity.EXPECT().Device().Return(nil) + + anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) + anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + + localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature) + + monitorPowerConfig := MonitorPowerConfig{ + ConnectedPhases: ConnectedPhasesABC, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + monitorCurrentConfig := MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + mpc, err := NewMPC( + localEntity, + s.Event, + &monitorPowerConfig, + nil, + &monitorCurrentConfig, + nil, + nil, + ) + assert.Nil(s.T(), err) + + measurements, err := server.NewMeasurement(localEntity) + assert.Nil(s.T(), err) + + var electricalConnection api.ElectricalConnectionServerInterface + electricalConnection, err = server.NewElectricalConnection(localEntity) + assert.Nil(s.T(), err) + + electricalConnectionId := model.ElectricalConnectionIdType(111) + constraints := make([]model.MeasurementConstraintsDataType, 0) + electricalConnection = mocks.NewElectricalConnectionServerInterface(s.T()) + electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil) + + err = mpc.configureMonitorCurrent( + measurements, + electricalConnection, + &electricalConnectionId, + &constraints, + ) + assert.NotNil(s.T(), err) // could not add parameter description TODO +} + +func (s *MuMpcUsecaseSuite) Test_configureMonitorVoltage() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity.EXPECT().Device().Return(nil) + + anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) + anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + + localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature) + + monitorPowerConfig := MonitorPowerConfig{ + ConnectedPhases: ConnectedPhasesABC, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + monitorVoltageConfig := MonitorVoltageConfig{ + SupportPhaseToPhase: true, + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + mpc, err := NewMPC( + localEntity, + s.Event, + &monitorPowerConfig, + nil, + nil, + &monitorVoltageConfig, + nil, + ) + assert.Nil(s.T(), err) + + measurements, err := server.NewMeasurement(localEntity) + assert.Nil(s.T(), err) + + var electricalConnection api.ElectricalConnectionServerInterface + electricalConnection, err = server.NewElectricalConnection(localEntity) + assert.Nil(s.T(), err) + + electricalConnectionId := model.ElectricalConnectionIdType(111) + constraints := make([]model.MeasurementConstraintsDataType, 0) + electricalConnection = mocks.NewElectricalConnectionServerInterface(s.T()) + electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil) + + err = mpc.configureMonitorVoltage( + measurements, + electricalConnection, + &electricalConnectionId, + &constraints, + ) + assert.NotNil(s.T(), err) // could not add parameter description TODO +} + +func (s *MuMpcUsecaseSuite) Test_configureMonitorFrequency() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity.EXPECT().Device().Return(nil) + + anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) + anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + + localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature) + + monitorPowerConfig := MonitorPowerConfig{ + ConnectedPhases: ConnectedPhasesABC, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + monitorFrequencyConfig := MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + } + + mpc, err := NewMPC( + localEntity, + s.Event, + &monitorPowerConfig, + nil, + nil, + nil, + &monitorFrequencyConfig, + ) + assert.Nil(s.T(), err) + + measurements, err := server.NewMeasurement(localEntity) + assert.Nil(s.T(), err) + + var electricalConnection api.ElectricalConnectionServerInterface + electricalConnection, err = server.NewElectricalConnection(localEntity) + assert.Nil(s.T(), err) + + electricalConnectionId := model.ElectricalConnectionIdType(111) + constraints := make([]model.MeasurementConstraintsDataType, 0) + electricalConnection = mocks.NewElectricalConnectionServerInterface(s.T()) + electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil) + + err = mpc.configureMonitorFrequency( + measurements, + electricalConnection, + &electricalConnectionId, + &constraints, + ) + assert.NotNil(s.T(), err) // could not add parameter description TODO +} From 5fc5d70b25b9bd6f68b09980f78fadf825355be9 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Fri, 13 Dec 2024 09:18:32 +0100 Subject: [PATCH 28/61] Increase test coverage --- usecases/mu/mpc/usecase_test.go | 78 +++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 24 deletions(-) diff --git a/usecases/mu/mpc/usecase_test.go b/usecases/mu/mpc/usecase_test.go index 4b1b3343..9920bbf5 100644 --- a/usecases/mu/mpc/usecase_test.go +++ b/usecases/mu/mpc/usecase_test.go @@ -280,17 +280,24 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorPower() { electricalConnection = mocks.NewElectricalConnectionServerInterface(s.T()) electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil) - err = mpc.configureMonitorPower( - measurements, - electricalConnection, - &electricalConnectionId, - nil, - ) + constellationsToCheck := []*ConnectedPhases{ + util.Ptr(ConnectedPhasesA), + util.Ptr(ConnectedPhasesB), + util.Ptr(ConnectedPhasesC), + } - assert.NotNil(s.T(), err) // could not add parameter description TODO + for _, phaseConstellation := range constellationsToCheck { + mpc.powerConfig.ConnectedPhases = *phaseConstellation - electricalConnection, err = server.NewElectricalConnection(localEntity) - assert.Nil(s.T(), err) + err = mpc.configureMonitorPower( + measurements, + electricalConnection, + &electricalConnectionId, + nil, + ) + + assert.NotNil(s.T(), err) // could not add parameter description + } } func (s *MuMpcUsecaseSuite) Test_configureMonitorEnergy() { @@ -406,13 +413,24 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorCurrent() { electricalConnection = mocks.NewElectricalConnectionServerInterface(s.T()) electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil) - err = mpc.configureMonitorCurrent( - measurements, - electricalConnection, - &electricalConnectionId, - &constraints, - ) - assert.NotNil(s.T(), err) // could not add parameter description TODO + constellationsToCheck := []*ConnectedPhases{ + util.Ptr(ConnectedPhasesA), + util.Ptr(ConnectedPhasesB), + util.Ptr(ConnectedPhasesC), + } + + for _, phaseConstellation := range constellationsToCheck { + mpc.powerConfig.ConnectedPhases = *phaseConstellation + + err = mpc.configureMonitorCurrent( + measurements, + electricalConnection, + &electricalConnectionId, + &constraints, + ) + + assert.NotNil(s.T(), err) // could not add parameter description + } } func (s *MuMpcUsecaseSuite) Test_configureMonitorVoltage() { @@ -463,16 +481,28 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorVoltage() { electricalConnectionId := model.ElectricalConnectionIdType(111) constraints := make([]model.MeasurementConstraintsDataType, 0) + electricalConnection = mocks.NewElectricalConnectionServerInterface(s.T()) electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil) - err = mpc.configureMonitorVoltage( - measurements, - electricalConnection, - &electricalConnectionId, - &constraints, - ) - assert.NotNil(s.T(), err) // could not add parameter description TODO + constellationsToCheck := []*ConnectedPhases{ + util.Ptr(ConnectedPhasesA), + util.Ptr(ConnectedPhasesB), + util.Ptr(ConnectedPhasesC), + } + + for _, phaseConstellation := range constellationsToCheck { + mpc.powerConfig.ConnectedPhases = *phaseConstellation + + err = mpc.configureMonitorVoltage( + measurements, + electricalConnection, + &electricalConnectionId, + &constraints, + ) + + assert.NotNil(s.T(), err) // could not add parameter description + } } func (s *MuMpcUsecaseSuite) Test_configureMonitorFrequency() { @@ -531,5 +561,5 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorFrequency() { &electricalConnectionId, &constraints, ) - assert.NotNil(s.T(), err) // could not add parameter description TODO + assert.NotNil(s.T(), err) // could not add parameter description } From 3ae9953d1798e03a9c51cbc04e2095bed3325d0a Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Fri, 13 Dec 2024 09:55:58 +0100 Subject: [PATCH 29/61] Add error coverage for NewMPC --- usecases/mu/mpc/usecase_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/usecases/mu/mpc/usecase_test.go b/usecases/mu/mpc/usecase_test.go index 9920bbf5..328d1504 100644 --- a/usecases/mu/mpc/usecase_test.go +++ b/usecases/mu/mpc/usecase_test.go @@ -128,6 +128,22 @@ func (s *MuMpcUsecaseSuite) Test_MpcOptionalParameters() { } } +func (s *MuMpcUsecaseSuite) Test_MpcRequredParametersError() { + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + + _, err := NewMPC( + localEntity, + s.Event, + nil, + nil, + nil, + nil, + nil, + ) + + assert.NotNil(s.T(), err) +} + func (s *MuMpcUsecaseSuite) Test_getMeasurementDataForId() { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) From 962c1af57aae89a1d03991e22afd504f473eff43 Mon Sep 17 00:00:00 2001 From: Mohamed Eltawel Date: Thu, 30 Oct 2025 22:22:47 +0300 Subject: [PATCH 30/61] - Update the mu-mpc APIs to use maps for per-phase measurement - Add more unit tests to increase the coverage --- api/featuresserver.go | 7 + mocks/DeviceClassificationClientInterface.go | 58 +- mocks/DeviceClassificationCommonInterface.go | 58 +- mocks/DeviceClassificationServerInterface.go | 34 +- mocks/DeviceConfigurationClientInterface.go | 318 ++--- mocks/DeviceConfigurationCommonInterface.go | 206 ++- mocks/DeviceConfigurationServerInterface.go | 301 ++-- mocks/DeviceDiagnosisClientInterface.go | 82 +- mocks/DeviceDiagnosisCommonInterface.go | 87 +- mocks/DeviceDiagnosisServerInterface.go | 68 +- mocks/ElectricalConnectionClientInterface.go | 190 ++- mocks/ElectricalConnectionCommonInterface.go | 354 +++-- mocks/ElectricalConnectionServerInterface.go | 587 ++++---- mocks/EntityEventCallback.go | 4 +- mocks/FeatureClientInterface.go | 171 ++- mocks/FeatureServerInterface.go | 34 +- mocks/IdentificationClientInterface.go | 58 +- mocks/IdentificationCommonInterface.go | 97 +- mocks/IdentificationServerInterface.go | 34 +- mocks/IncentiveTableClientInterface.go | 174 ++- mocks/IncentiveTableCommonInterface.go | 116 +- mocks/IncentiveTableServerInterface.go | 34 +- mocks/LoadControlClientInterface.go | 195 ++- mocks/LoadControlCommonInterface.go | 206 ++- mocks/LoadControlServerInterface.go | 122 +- mocks/MeasurementClientInterface.go | 151 +- mocks/MeasurementCommonInterface.go | 240 ++-- mocks/MeasurementServerInterface.go | 122 +- mocks/ServiceInterface.go | 175 ++- mocks/ServiceReaderInterface.go | 37 +- .../SmartEnergyManagementPsClientInterface.go | 92 +- .../SmartEnergyManagementPsCommonInterface.go | 58 +- .../SmartEnergyManagementPsServerInterface.go | 34 +- mocks/TimeSeriesClientInterface.go | 185 ++- mocks/TimeSeriesCommonInterface.go | 126 +- mocks/TimeSeriesServerInterface.go | 34 +- mocks/UseCaseBaseInterface.go | 181 ++- mocks/UseCaseInterface.go | 196 ++- service/service.go | 3 +- service/service_test.go | 8 + usecases/api/mu_mpc.go | 10 +- usecases/mocks/CemCEVCInterface.go | 589 ++++---- usecases/mocks/CemEVCCInterface.go | 517 ++++--- usecases/mocks/CemEVCEMInterface.go | 348 +++-- usecases/mocks/CemEVSECCInterface.go | 285 ++-- usecases/mocks/CemEVSOCInterface.go | 234 ++-- usecases/mocks/CemOPEVInterface.go | 379 +++-- usecases/mocks/CemOSCEVInterface.go | 379 +++-- usecases/mocks/CemVABDInterface.go | 348 +++-- usecases/mocks/CemVAPDInterface.go | 310 ++--- usecases/mocks/CsLPCInterface.go | 479 +++---- usecases/mocks/CsLPPInterface.go | 479 +++---- usecases/mocks/EgLPCInterface.go | 535 +++----- usecases/mocks/EgLPPInterface.go | 535 +++----- usecases/mocks/MaMGCPInterface.go | 462 +++---- usecases/mocks/MaMPCInterface.go | 462 +++---- usecases/mocks/MuMPCInterface.go | 1216 +++++++++-------- usecases/mocks/UpdateData.go | 66 +- usecases/mocks/UpdateMeasurementData.go | 79 +- usecases/mu/mpc/config.go | 54 +- usecases/mu/mpc/config_test.go | 31 +- usecases/mu/mpc/public.go | 168 ++- usecases/mu/mpc/public_abc_test.go | 67 +- usecases/mu/mpc/public_bc_test.go | 50 +- usecases/mu/mpc/public_constraint_test.go | 472 +++++-- usecases/mu/mpc/usecase.go | 257 ++-- usecases/mu/mpc/usecase_test.go | 342 +++-- 67 files changed, 6711 insertions(+), 7679 deletions(-) diff --git a/api/featuresserver.go b/api/featuresserver.go index 23e79fd8..edc57f0f 100644 --- a/api/featuresserver.go +++ b/api/featuresserver.go @@ -109,6 +109,13 @@ type ElectricalConnectionServerInterface interface { deleteSelector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, deleteElements *model.ElectricalConnectionPermittedValueSetDataElementsType, ) error + + // either returns the given description id or creates a new one for the given description + // + // will return error if could not add the new description + GetOrAddIdForDescription( + electricalConnectionDescription model.ElectricalConnectionDescriptionDataType, + ) (*model.ElectricalConnectionIdType, error) } type LoadControlLimitDataForID struct { diff --git a/mocks/DeviceClassificationClientInterface.go b/mocks/DeviceClassificationClientInterface.go index 76bcffae..65148766 100644 --- a/mocks/DeviceClassificationClientInterface.go +++ b/mocks/DeviceClassificationClientInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewDeviceClassificationClientInterface creates a new instance of DeviceClassificationClientInterface. 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 NewDeviceClassificationClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceClassificationClientInterface { - mock := &DeviceClassificationClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // DeviceClassificationClientInterface is an autogenerated mock type for the DeviceClassificationClientInterface type type DeviceClassificationClientInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *DeviceClassificationClientInterface) EXPECT() *DeviceClassificationCli return &DeviceClassificationClientInterface_Expecter{mock: &_m.Mock} } -// RequestManufacturerDetails provides a mock function for the type DeviceClassificationClientInterface -func (_mock *DeviceClassificationClientInterface) RequestManufacturerDetails() (*model.MsgCounterType, error) { - ret := _mock.Called() +// RequestManufacturerDetails provides a mock function with no fields +func (_m *DeviceClassificationClientInterface) RequestManufacturerDetails() (*model.MsgCounterType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RequestManufacturerDetails") @@ -46,21 +30,23 @@ func (_mock *DeviceClassificationClientInterface) RequestManufacturerDetails() ( var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -81,8 +67,8 @@ func (_c *DeviceClassificationClientInterface_RequestManufacturerDetails_Call) R return _c } -func (_c *DeviceClassificationClientInterface_RequestManufacturerDetails_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceClassificationClientInterface_RequestManufacturerDetails_Call { - _c.Call.Return(msgCounterType, err) +func (_c *DeviceClassificationClientInterface_RequestManufacturerDetails_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceClassificationClientInterface_RequestManufacturerDetails_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -90,3 +76,17 @@ func (_c *DeviceClassificationClientInterface_RequestManufacturerDetails_Call) R _c.Call.Return(run) return _c } + +// NewDeviceClassificationClientInterface creates a new instance of DeviceClassificationClientInterface. 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 NewDeviceClassificationClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceClassificationClientInterface { + mock := &DeviceClassificationClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/DeviceClassificationCommonInterface.go b/mocks/DeviceClassificationCommonInterface.go index 41d3e52d..cd265b04 100644 --- a/mocks/DeviceClassificationCommonInterface.go +++ b/mocks/DeviceClassificationCommonInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewDeviceClassificationCommonInterface creates a new instance of DeviceClassificationCommonInterface. 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 NewDeviceClassificationCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceClassificationCommonInterface { - mock := &DeviceClassificationCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // DeviceClassificationCommonInterface is an autogenerated mock type for the DeviceClassificationCommonInterface type type DeviceClassificationCommonInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *DeviceClassificationCommonInterface) EXPECT() *DeviceClassificationCom return &DeviceClassificationCommonInterface_Expecter{mock: &_m.Mock} } -// GetManufacturerDetails provides a mock function for the type DeviceClassificationCommonInterface -func (_mock *DeviceClassificationCommonInterface) GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error) { - ret := _mock.Called() +// GetManufacturerDetails provides a mock function with no fields +func (_m *DeviceClassificationCommonInterface) GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for GetManufacturerDetails") @@ -46,21 +30,23 @@ func (_mock *DeviceClassificationCommonInterface) GetManufacturerDetails() (*mod var r0 *model.DeviceClassificationManufacturerDataType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.DeviceClassificationManufacturerDataType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.DeviceClassificationManufacturerDataType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.DeviceClassificationManufacturerDataType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.DeviceClassificationManufacturerDataType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceClassificationManufacturerDataType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -81,8 +67,8 @@ func (_c *DeviceClassificationCommonInterface_GetManufacturerDetails_Call) Run(r return _c } -func (_c *DeviceClassificationCommonInterface_GetManufacturerDetails_Call) Return(deviceClassificationManufacturerDataType *model.DeviceClassificationManufacturerDataType, err error) *DeviceClassificationCommonInterface_GetManufacturerDetails_Call { - _c.Call.Return(deviceClassificationManufacturerDataType, err) +func (_c *DeviceClassificationCommonInterface_GetManufacturerDetails_Call) Return(_a0 *model.DeviceClassificationManufacturerDataType, _a1 error) *DeviceClassificationCommonInterface_GetManufacturerDetails_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -90,3 +76,17 @@ func (_c *DeviceClassificationCommonInterface_GetManufacturerDetails_Call) RunAn _c.Call.Return(run) return _c } + +// NewDeviceClassificationCommonInterface creates a new instance of DeviceClassificationCommonInterface. 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 NewDeviceClassificationCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceClassificationCommonInterface { + mock := &DeviceClassificationCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/DeviceClassificationServerInterface.go b/mocks/DeviceClassificationServerInterface.go index 5c732083..f62c6fd1 100644 --- a/mocks/DeviceClassificationServerInterface.go +++ b/mocks/DeviceClassificationServerInterface.go @@ -1,12 +1,21 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks -import ( - mock "github.com/stretchr/testify/mock" -) +import mock "github.com/stretchr/testify/mock" + +// DeviceClassificationServerInterface is an autogenerated mock type for the DeviceClassificationServerInterface type +type DeviceClassificationServerInterface struct { + mock.Mock +} + +type DeviceClassificationServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *DeviceClassificationServerInterface) EXPECT() *DeviceClassificationServerInterface_Expecter { + return &DeviceClassificationServerInterface_Expecter{mock: &_m.Mock} +} // NewDeviceClassificationServerInterface creates a new instance of DeviceClassificationServerInterface. 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. @@ -21,16 +30,3 @@ func NewDeviceClassificationServerInterface(t interface { return mock } - -// DeviceClassificationServerInterface is an autogenerated mock type for the DeviceClassificationServerInterface type -type DeviceClassificationServerInterface struct { - mock.Mock -} - -type DeviceClassificationServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *DeviceClassificationServerInterface) EXPECT() *DeviceClassificationServerInterface_Expecter { - return &DeviceClassificationServerInterface_Expecter{mock: &_m.Mock} -} diff --git a/mocks/DeviceConfigurationClientInterface.go b/mocks/DeviceConfigurationClientInterface.go index 1d196160..cd0b6ef3 100644 --- a/mocks/DeviceConfigurationClientInterface.go +++ b/mocks/DeviceConfigurationClientInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewDeviceConfigurationClientInterface creates a new instance of DeviceConfigurationClientInterface. 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 NewDeviceConfigurationClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceConfigurationClientInterface { - mock := &DeviceConfigurationClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // DeviceConfigurationClientInterface is an autogenerated mock type for the DeviceConfigurationClientInterface type type DeviceConfigurationClientInterface struct { mock.Mock @@ -36,20 +20,21 @@ func (_m *DeviceConfigurationClientInterface) EXPECT() *DeviceConfigurationClien return &DeviceConfigurationClientInterface_Expecter{mock: &_m.Mock} } -// CheckEventPayloadDataForFilter provides a mock function for the type DeviceConfigurationClientInterface -func (_mock *DeviceConfigurationClientInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { - ret := _mock.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter +func (_m *DeviceConfigurationClientInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { + ret := _m.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { - r0 = returnFunc(payloadData, filter) + if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { + r0 = rf(payloadData, filter) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -59,43 +44,32 @@ type DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call stru } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData any -// - filter any +// - payloadData interface{} +// - filter interface{} func (_e *DeviceConfigurationClientInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { return &DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 any - if args[0] != nil { - arg0 = args[0].(any) - } - var arg1 any - if args[1] != nil { - arg1 = args[1].(any) - } - run( - arg0, - arg1, - ) + run(args[0].(interface{}), args[1].(interface{})) }) return _c } -func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(b) +func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(_a0) return _c } -func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForFilter provides a mock function for the type DeviceConfigurationClientInterface -func (_mock *DeviceConfigurationClientInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _mock.Called(filter) +// GetKeyValueDataForFilter provides a mock function with given fields: filter +func (_m *DeviceConfigurationClientInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForFilter") @@ -103,21 +77,23 @@ func (_mock *DeviceConfigurationClientInterface) GetKeyValueDataForFilter(filter var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -134,30 +110,24 @@ func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDataForFilter( func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyValueDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) }) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call { - _c.Call.Return(deviceConfigurationKeyValueDataType, err) +func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call { +func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForKeyId provides a mock function for the type DeviceConfigurationClientInterface -func (_mock *DeviceConfigurationClientInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _mock.Called(keyId) +// GetKeyValueDataForKeyId provides a mock function with given fields: keyId +func (_m *DeviceConfigurationClientInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _m.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForKeyId") @@ -165,21 +135,23 @@ func (_mock *DeviceConfigurationClientInterface) GetKeyValueDataForKeyId(keyId m var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return rf(keyId) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = rf(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = returnFunc(keyId) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = rf(keyId) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -196,30 +168,24 @@ func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDataForKeyId(k func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyIdType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyIdType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyIdType)) }) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call { - _c.Call.Return(deviceConfigurationKeyValueDataType, err) +func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call { +func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionFoKeyId provides a mock function for the type DeviceConfigurationClientInterface -func (_mock *DeviceConfigurationClientInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _mock.Called(keyId) +// GetKeyValueDescriptionFoKeyId provides a mock function with given fields: keyId +func (_m *DeviceConfigurationClientInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _m.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionFoKeyId") @@ -227,21 +193,23 @@ func (_mock *DeviceConfigurationClientInterface) GetKeyValueDescriptionFoKeyId(k var r0 *model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return rf(keyId) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = rf(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = returnFunc(keyId) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = rf(keyId) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -258,30 +226,24 @@ func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDescriptionFoK func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyIdType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyIdType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyIdType)) }) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call) Return(deviceConfigurationKeyValueDescriptionDataType *model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call { - _c.Call.Return(deviceConfigurationKeyValueDescriptionDataType, err) +func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call { +func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionsForFilter provides a mock function for the type DeviceConfigurationClientInterface -func (_mock *DeviceConfigurationClientInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetKeyValueDescriptionsForFilter provides a mock function with given fields: filter +func (_m *DeviceConfigurationClientInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionsForFilter") @@ -289,21 +251,23 @@ func (_mock *DeviceConfigurationClientInterface) GetKeyValueDescriptionsForFilte var r0 []model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.DeviceConfigurationKeyValueDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -320,30 +284,24 @@ func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDescriptionsFo func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyValueDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) }) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call) Return(deviceConfigurationKeyValueDescriptionDataTypes []model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call { - _c.Call.Return(deviceConfigurationKeyValueDescriptionDataTypes, err) +func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call) Return(_a0 []model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call { +func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Return(run) return _c } -// RequestKeyValueDescriptions provides a mock function for the type DeviceConfigurationClientInterface -func (_mock *DeviceConfigurationClientInterface) RequestKeyValueDescriptions(selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestKeyValueDescriptions provides a mock function with given fields: selector, elements +func (_m *DeviceConfigurationClientInterface) RequestKeyValueDescriptions(selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestKeyValueDescriptions") @@ -351,21 +309,23 @@ func (_mock *DeviceConfigurationClientInterface) RequestKeyValueDescriptions(sel var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -383,35 +343,24 @@ func (_e *DeviceConfigurationClientInterface_Expecter) RequestKeyValueDescriptio func (_c *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call) Run(run func(selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType)) *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType) - } - var arg1 *model.DeviceConfigurationKeyValueDescriptionDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.DeviceConfigurationKeyValueDescriptionDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType), args[1].(*model.DeviceConfigurationKeyValueDescriptionDataElementsType)) }) return _c } -func (_c *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call { - _c.Call.Return(msgCounterType, err) +func (_c *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call) RunAndReturn(run func(selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call { +func (_c *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call) RunAndReturn(run func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call { _c.Call.Return(run) return _c } -// RequestKeyValues provides a mock function for the type DeviceConfigurationClientInterface -func (_mock *DeviceConfigurationClientInterface) RequestKeyValues(selector *model.DeviceConfigurationKeyValueListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestKeyValues provides a mock function with given fields: selector, elements +func (_m *DeviceConfigurationClientInterface) RequestKeyValues(selector *model.DeviceConfigurationKeyValueListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestKeyValues") @@ -419,21 +368,23 @@ func (_mock *DeviceConfigurationClientInterface) RequestKeyValues(selector *mode var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -451,35 +402,24 @@ func (_e *DeviceConfigurationClientInterface_Expecter) RequestKeyValues(selector func (_c *DeviceConfigurationClientInterface_RequestKeyValues_Call) Run(run func(selector *model.DeviceConfigurationKeyValueListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDataElementsType)) *DeviceConfigurationClientInterface_RequestKeyValues_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.DeviceConfigurationKeyValueListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.DeviceConfigurationKeyValueListDataSelectorsType) - } - var arg1 *model.DeviceConfigurationKeyValueDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.DeviceConfigurationKeyValueDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.DeviceConfigurationKeyValueListDataSelectorsType), args[1].(*model.DeviceConfigurationKeyValueDataElementsType)) }) return _c } -func (_c *DeviceConfigurationClientInterface_RequestKeyValues_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceConfigurationClientInterface_RequestKeyValues_Call { - _c.Call.Return(msgCounterType, err) +func (_c *DeviceConfigurationClientInterface_RequestKeyValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceConfigurationClientInterface_RequestKeyValues_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationClientInterface_RequestKeyValues_Call) RunAndReturn(run func(selector *model.DeviceConfigurationKeyValueListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_RequestKeyValues_Call { +func (_c *DeviceConfigurationClientInterface_RequestKeyValues_Call) RunAndReturn(run func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_RequestKeyValues_Call { _c.Call.Return(run) return _c } -// WriteKeyValues provides a mock function for the type DeviceConfigurationClientInterface -func (_mock *DeviceConfigurationClientInterface) WriteKeyValues(data []model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error) { - ret := _mock.Called(data) +// WriteKeyValues provides a mock function with given fields: data +func (_m *DeviceConfigurationClientInterface) WriteKeyValues(data []model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error) { + ret := _m.Called(data) if len(ret) == 0 { panic("no return value specified for WriteKeyValues") @@ -487,21 +427,23 @@ func (_mock *DeviceConfigurationClientInterface) WriteKeyValues(data []model.Dev var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func([]model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error)); ok { - return returnFunc(data) + if rf, ok := ret.Get(0).(func([]model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error)); ok { + return rf(data) } - if returnFunc, ok := ret.Get(0).(func([]model.DeviceConfigurationKeyValueDataType) *model.MsgCounterType); ok { - r0 = returnFunc(data) + if rf, ok := ret.Get(0).(func([]model.DeviceConfigurationKeyValueDataType) *model.MsgCounterType); ok { + r0 = rf(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func([]model.DeviceConfigurationKeyValueDataType) error); ok { - r1 = returnFunc(data) + + if rf, ok := ret.Get(1).(func([]model.DeviceConfigurationKeyValueDataType) error); ok { + r1 = rf(data) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -518,23 +460,31 @@ func (_e *DeviceConfigurationClientInterface_Expecter) WriteKeyValues(data inter func (_c *DeviceConfigurationClientInterface_WriteKeyValues_Call) Run(run func(data []model.DeviceConfigurationKeyValueDataType)) *DeviceConfigurationClientInterface_WriteKeyValues_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []model.DeviceConfigurationKeyValueDataType - if args[0] != nil { - arg0 = args[0].([]model.DeviceConfigurationKeyValueDataType) - } - run( - arg0, - ) + run(args[0].([]model.DeviceConfigurationKeyValueDataType)) }) return _c } -func (_c *DeviceConfigurationClientInterface_WriteKeyValues_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceConfigurationClientInterface_WriteKeyValues_Call { - _c.Call.Return(msgCounterType, err) +func (_c *DeviceConfigurationClientInterface_WriteKeyValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceConfigurationClientInterface_WriteKeyValues_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationClientInterface_WriteKeyValues_Call) RunAndReturn(run func(data []model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_WriteKeyValues_Call { +func (_c *DeviceConfigurationClientInterface_WriteKeyValues_Call) RunAndReturn(run func([]model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_WriteKeyValues_Call { _c.Call.Return(run) return _c } + +// NewDeviceConfigurationClientInterface creates a new instance of DeviceConfigurationClientInterface. 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 NewDeviceConfigurationClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceConfigurationClientInterface { + mock := &DeviceConfigurationClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/DeviceConfigurationCommonInterface.go b/mocks/DeviceConfigurationCommonInterface.go index 469b445d..56fdc8a7 100644 --- a/mocks/DeviceConfigurationCommonInterface.go +++ b/mocks/DeviceConfigurationCommonInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewDeviceConfigurationCommonInterface creates a new instance of DeviceConfigurationCommonInterface. 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 NewDeviceConfigurationCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceConfigurationCommonInterface { - mock := &DeviceConfigurationCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // DeviceConfigurationCommonInterface is an autogenerated mock type for the DeviceConfigurationCommonInterface type type DeviceConfigurationCommonInterface struct { mock.Mock @@ -36,20 +20,21 @@ func (_m *DeviceConfigurationCommonInterface) EXPECT() *DeviceConfigurationCommo return &DeviceConfigurationCommonInterface_Expecter{mock: &_m.Mock} } -// CheckEventPayloadDataForFilter provides a mock function for the type DeviceConfigurationCommonInterface -func (_mock *DeviceConfigurationCommonInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { - ret := _mock.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter +func (_m *DeviceConfigurationCommonInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { + ret := _m.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { - r0 = returnFunc(payloadData, filter) + if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { + r0 = rf(payloadData, filter) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -59,43 +44,32 @@ type DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call stru } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData any -// - filter any +// - payloadData interface{} +// - filter interface{} func (_e *DeviceConfigurationCommonInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { return &DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 any - if args[0] != nil { - arg0 = args[0].(any) - } - var arg1 any - if args[1] != nil { - arg1 = args[1].(any) - } - run( - arg0, - arg1, - ) + run(args[0].(interface{}), args[1].(interface{})) }) return _c } -func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(b) +func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(_a0) return _c } -func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForFilter provides a mock function for the type DeviceConfigurationCommonInterface -func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _mock.Called(filter) +// GetKeyValueDataForFilter provides a mock function with given fields: filter +func (_m *DeviceConfigurationCommonInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForFilter") @@ -103,21 +77,23 @@ func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDataForFilter(filter var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -134,30 +110,24 @@ func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDataForFilter( func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyValueDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) }) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call { - _c.Call.Return(deviceConfigurationKeyValueDataType, err) +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call { +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForKeyId provides a mock function for the type DeviceConfigurationCommonInterface -func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _mock.Called(keyId) +// GetKeyValueDataForKeyId provides a mock function with given fields: keyId +func (_m *DeviceConfigurationCommonInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _m.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForKeyId") @@ -165,21 +135,23 @@ func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDataForKeyId(keyId m var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return rf(keyId) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = rf(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = returnFunc(keyId) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = rf(keyId) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -196,30 +168,24 @@ func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDataForKeyId(k func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyIdType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyIdType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyIdType)) }) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call { - _c.Call.Return(deviceConfigurationKeyValueDataType, err) +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call { +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionFoKeyId provides a mock function for the type DeviceConfigurationCommonInterface -func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _mock.Called(keyId) +// GetKeyValueDescriptionFoKeyId provides a mock function with given fields: keyId +func (_m *DeviceConfigurationCommonInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _m.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionFoKeyId") @@ -227,21 +193,23 @@ func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDescriptionFoKeyId(k var r0 *model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return rf(keyId) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = rf(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = returnFunc(keyId) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = rf(keyId) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -258,30 +226,24 @@ func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDescriptionFoK func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyIdType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyIdType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyIdType)) }) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call) Return(deviceConfigurationKeyValueDescriptionDataType *model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call { - _c.Call.Return(deviceConfigurationKeyValueDescriptionDataType, err) +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call { +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionsForFilter provides a mock function for the type DeviceConfigurationCommonInterface -func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetKeyValueDescriptionsForFilter provides a mock function with given fields: filter +func (_m *DeviceConfigurationCommonInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionsForFilter") @@ -289,21 +251,23 @@ func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDescriptionsForFilte var r0 []model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.DeviceConfigurationKeyValueDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -320,23 +284,31 @@ func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDescriptionsFo func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyValueDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) }) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call) Return(deviceConfigurationKeyValueDescriptionDataTypes []model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call { - _c.Call.Return(deviceConfigurationKeyValueDescriptionDataTypes, err) +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call) Return(_a0 []model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call { +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Return(run) return _c } + +// NewDeviceConfigurationCommonInterface creates a new instance of DeviceConfigurationCommonInterface. 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 NewDeviceConfigurationCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceConfigurationCommonInterface { + mock := &DeviceConfigurationCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/DeviceConfigurationServerInterface.go b/mocks/DeviceConfigurationServerInterface.go index ed35a0e0..157065da 100644 --- a/mocks/DeviceConfigurationServerInterface.go +++ b/mocks/DeviceConfigurationServerInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewDeviceConfigurationServerInterface creates a new instance of DeviceConfigurationServerInterface. 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 NewDeviceConfigurationServerInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceConfigurationServerInterface { - mock := &DeviceConfigurationServerInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // DeviceConfigurationServerInterface is an autogenerated mock type for the DeviceConfigurationServerInterface type type DeviceConfigurationServerInterface struct { mock.Mock @@ -36,22 +20,23 @@ func (_m *DeviceConfigurationServerInterface) EXPECT() *DeviceConfigurationServe return &DeviceConfigurationServerInterface_Expecter{mock: &_m.Mock} } -// AddKeyValueDescription provides a mock function for the type DeviceConfigurationServerInterface -func (_mock *DeviceConfigurationServerInterface) AddKeyValueDescription(description model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType { - ret := _mock.Called(description) +// AddKeyValueDescription provides a mock function with given fields: description +func (_m *DeviceConfigurationServerInterface) AddKeyValueDescription(description model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType { + ret := _m.Called(description) if len(ret) == 0 { panic("no return value specified for AddKeyValueDescription") } var r0 *model.DeviceConfigurationKeyIdType - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType); ok { - r0 = returnFunc(description) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType); ok { + r0 = rf(description) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyIdType) } } + return r0 } @@ -68,41 +53,36 @@ func (_e *DeviceConfigurationServerInterface_Expecter) AddKeyValueDescription(de func (_c *DeviceConfigurationServerInterface_AddKeyValueDescription_Call) Run(run func(description model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationServerInterface_AddKeyValueDescription_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyValueDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) }) return _c } -func (_c *DeviceConfigurationServerInterface_AddKeyValueDescription_Call) Return(deviceConfigurationKeyIdType *model.DeviceConfigurationKeyIdType) *DeviceConfigurationServerInterface_AddKeyValueDescription_Call { - _c.Call.Return(deviceConfigurationKeyIdType) +func (_c *DeviceConfigurationServerInterface_AddKeyValueDescription_Call) Return(_a0 *model.DeviceConfigurationKeyIdType) *DeviceConfigurationServerInterface_AddKeyValueDescription_Call { + _c.Call.Return(_a0) return _c } -func (_c *DeviceConfigurationServerInterface_AddKeyValueDescription_Call) RunAndReturn(run func(description model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType) *DeviceConfigurationServerInterface_AddKeyValueDescription_Call { +func (_c *DeviceConfigurationServerInterface_AddKeyValueDescription_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType) *DeviceConfigurationServerInterface_AddKeyValueDescription_Call { _c.Call.Return(run) return _c } -// CheckEventPayloadDataForFilter provides a mock function for the type DeviceConfigurationServerInterface -func (_mock *DeviceConfigurationServerInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { - ret := _mock.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter +func (_m *DeviceConfigurationServerInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { + ret := _m.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { - r0 = returnFunc(payloadData, filter) + if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { + r0 = rf(payloadData, filter) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -112,43 +92,32 @@ type DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call stru } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData any -// - filter any +// - payloadData interface{} +// - filter interface{} func (_e *DeviceConfigurationServerInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { return &DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 any - if args[0] != nil { - arg0 = args[0].(any) - } - var arg1 any - if args[1] != nil { - arg1 = args[1].(any) - } - run( - arg0, - arg1, - ) + run(args[0].(interface{}), args[1].(interface{})) }) return _c } -func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(b) +func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(_a0) return _c } -func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForFilter provides a mock function for the type DeviceConfigurationServerInterface -func (_mock *DeviceConfigurationServerInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _mock.Called(filter) +// GetKeyValueDataForFilter provides a mock function with given fields: filter +func (_m *DeviceConfigurationServerInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForFilter") @@ -156,21 +125,23 @@ func (_mock *DeviceConfigurationServerInterface) GetKeyValueDataForFilter(filter var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -187,30 +158,24 @@ func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDataForFilter( func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyValueDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) }) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call { - _c.Call.Return(deviceConfigurationKeyValueDataType, err) +func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call { +func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForKeyId provides a mock function for the type DeviceConfigurationServerInterface -func (_mock *DeviceConfigurationServerInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _mock.Called(keyId) +// GetKeyValueDataForKeyId provides a mock function with given fields: keyId +func (_m *DeviceConfigurationServerInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _m.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForKeyId") @@ -218,21 +183,23 @@ func (_mock *DeviceConfigurationServerInterface) GetKeyValueDataForKeyId(keyId m var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return rf(keyId) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = rf(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = returnFunc(keyId) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = rf(keyId) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -249,30 +216,24 @@ func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDataForKeyId(k func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyIdType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyIdType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyIdType)) }) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call { - _c.Call.Return(deviceConfigurationKeyValueDataType, err) +func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call { +func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionFoKeyId provides a mock function for the type DeviceConfigurationServerInterface -func (_mock *DeviceConfigurationServerInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _mock.Called(keyId) +// GetKeyValueDescriptionFoKeyId provides a mock function with given fields: keyId +func (_m *DeviceConfigurationServerInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _m.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionFoKeyId") @@ -280,21 +241,23 @@ func (_mock *DeviceConfigurationServerInterface) GetKeyValueDescriptionFoKeyId(k var r0 *model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return rf(keyId) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = returnFunc(keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = rf(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = returnFunc(keyId) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = rf(keyId) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -311,30 +274,24 @@ func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDescriptionFoK func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyIdType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyIdType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyIdType)) }) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call) Return(deviceConfigurationKeyValueDescriptionDataType *model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call { - _c.Call.Return(deviceConfigurationKeyValueDescriptionDataType, err) +func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call { +func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionsForFilter provides a mock function for the type DeviceConfigurationServerInterface -func (_mock *DeviceConfigurationServerInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetKeyValueDescriptionsForFilter provides a mock function with given fields: filter +func (_m *DeviceConfigurationServerInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionsForFilter") @@ -342,21 +299,23 @@ func (_mock *DeviceConfigurationServerInterface) GetKeyValueDescriptionsForFilte var r0 []model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.DeviceConfigurationKeyValueDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -373,41 +332,36 @@ func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDescriptionsFo func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyValueDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) }) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call) Return(deviceConfigurationKeyValueDescriptionDataTypes []model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call { - _c.Call.Return(deviceConfigurationKeyValueDescriptionDataTypes, err) +func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call) Return(_a0 []model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call { +func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Return(run) return _c } -// UpdateKeyValueDataForFilter provides a mock function for the type DeviceConfigurationServerInterface -func (_mock *DeviceConfigurationServerInterface) UpdateKeyValueDataForFilter(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, filter model.DeviceConfigurationKeyValueDescriptionDataType) error { - ret := _mock.Called(data, deleteElements, filter) +// UpdateKeyValueDataForFilter provides a mock function with given fields: data, deleteElements, filter +func (_m *DeviceConfigurationServerInterface) UpdateKeyValueDataForFilter(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, filter model.DeviceConfigurationKeyValueDescriptionDataType) error { + ret := _m.Called(data, deleteElements, filter) if len(ret) == 0 { panic("no return value specified for UpdateKeyValueDataForFilter") } var r0 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r0 = returnFunc(data, deleteElements, filter) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r0 = rf(data, deleteElements, filter) } else { r0 = ret.Error(0) } + return r0 } @@ -426,51 +380,36 @@ func (_e *DeviceConfigurationServerInterface_Expecter) UpdateKeyValueDataForFilt func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call) Run(run func(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyValueDataType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyValueDataType) - } - var arg1 *model.DeviceConfigurationKeyValueDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.DeviceConfigurationKeyValueDataElementsType) - } - var arg2 model.DeviceConfigurationKeyValueDescriptionDataType - if args[2] != nil { - arg2 = args[2].(model.DeviceConfigurationKeyValueDescriptionDataType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(model.DeviceConfigurationKeyValueDataType), args[1].(*model.DeviceConfigurationKeyValueDataElementsType), args[2].(model.DeviceConfigurationKeyValueDescriptionDataType)) }) return _c } -func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call) Return(err error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call { - _c.Call.Return(err) +func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call) Return(_a0 error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call { + _c.Call.Return(_a0) return _c } -func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call) RunAndReturn(run func(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, filter model.DeviceConfigurationKeyValueDescriptionDataType) error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call { +func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyValueDescriptionDataType) error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call { _c.Call.Return(run) return _c } -// UpdateKeyValueDataForKeyId provides a mock function for the type DeviceConfigurationServerInterface -func (_mock *DeviceConfigurationServerInterface) UpdateKeyValueDataForKeyId(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, keyId model.DeviceConfigurationKeyIdType) error { - ret := _mock.Called(data, deleteElements, keyId) +// UpdateKeyValueDataForKeyId provides a mock function with given fields: data, deleteElements, keyId +func (_m *DeviceConfigurationServerInterface) UpdateKeyValueDataForKeyId(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, keyId model.DeviceConfigurationKeyIdType) error { + ret := _m.Called(data, deleteElements, keyId) if len(ret) == 0 { panic("no return value specified for UpdateKeyValueDataForKeyId") } var r0 error - if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyIdType) error); ok { - r0 = returnFunc(data, deleteElements, keyId) + if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyIdType) error); ok { + r0 = rf(data, deleteElements, keyId) } else { r0 = ret.Error(0) } + return r0 } @@ -489,33 +428,31 @@ func (_e *DeviceConfigurationServerInterface_Expecter) UpdateKeyValueDataForKeyI func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call) Run(run func(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceConfigurationKeyValueDataType - if args[0] != nil { - arg0 = args[0].(model.DeviceConfigurationKeyValueDataType) - } - var arg1 *model.DeviceConfigurationKeyValueDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.DeviceConfigurationKeyValueDataElementsType) - } - var arg2 model.DeviceConfigurationKeyIdType - if args[2] != nil { - arg2 = args[2].(model.DeviceConfigurationKeyIdType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(model.DeviceConfigurationKeyValueDataType), args[1].(*model.DeviceConfigurationKeyValueDataElementsType), args[2].(model.DeviceConfigurationKeyIdType)) }) return _c } -func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call) Return(err error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call { - _c.Call.Return(err) +func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call) Return(_a0 error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call { + _c.Call.Return(_a0) return _c } -func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call) RunAndReturn(run func(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, keyId model.DeviceConfigurationKeyIdType) error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call { +func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyIdType) error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call { _c.Call.Return(run) return _c } + +// NewDeviceConfigurationServerInterface creates a new instance of DeviceConfigurationServerInterface. 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 NewDeviceConfigurationServerInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceConfigurationServerInterface { + mock := &DeviceConfigurationServerInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/DeviceDiagnosisClientInterface.go b/mocks/DeviceDiagnosisClientInterface.go index 5c055802..cd1c0aba 100644 --- a/mocks/DeviceDiagnosisClientInterface.go +++ b/mocks/DeviceDiagnosisClientInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewDeviceDiagnosisClientInterface creates a new instance of DeviceDiagnosisClientInterface. 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 NewDeviceDiagnosisClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceDiagnosisClientInterface { - mock := &DeviceDiagnosisClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // DeviceDiagnosisClientInterface is an autogenerated mock type for the DeviceDiagnosisClientInterface type type DeviceDiagnosisClientInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *DeviceDiagnosisClientInterface) EXPECT() *DeviceDiagnosisClientInterfa return &DeviceDiagnosisClientInterface_Expecter{mock: &_m.Mock} } -// RequestHeartbeat provides a mock function for the type DeviceDiagnosisClientInterface -func (_mock *DeviceDiagnosisClientInterface) RequestHeartbeat() (*model.MsgCounterType, error) { - ret := _mock.Called() +// RequestHeartbeat provides a mock function with no fields +func (_m *DeviceDiagnosisClientInterface) RequestHeartbeat() (*model.MsgCounterType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RequestHeartbeat") @@ -46,21 +30,23 @@ func (_mock *DeviceDiagnosisClientInterface) RequestHeartbeat() (*model.MsgCount var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -81,8 +67,8 @@ func (_c *DeviceDiagnosisClientInterface_RequestHeartbeat_Call) Run(run func()) return _c } -func (_c *DeviceDiagnosisClientInterface_RequestHeartbeat_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceDiagnosisClientInterface_RequestHeartbeat_Call { - _c.Call.Return(msgCounterType, err) +func (_c *DeviceDiagnosisClientInterface_RequestHeartbeat_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceDiagnosisClientInterface_RequestHeartbeat_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -91,9 +77,9 @@ func (_c *DeviceDiagnosisClientInterface_RequestHeartbeat_Call) RunAndReturn(run return _c } -// RequestState provides a mock function for the type DeviceDiagnosisClientInterface -func (_mock *DeviceDiagnosisClientInterface) RequestState() (*model.MsgCounterType, error) { - ret := _mock.Called() +// RequestState provides a mock function with no fields +func (_m *DeviceDiagnosisClientInterface) RequestState() (*model.MsgCounterType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RequestState") @@ -101,21 +87,23 @@ func (_mock *DeviceDiagnosisClientInterface) RequestState() (*model.MsgCounterTy var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -136,8 +124,8 @@ func (_c *DeviceDiagnosisClientInterface_RequestState_Call) Run(run func()) *Dev return _c } -func (_c *DeviceDiagnosisClientInterface_RequestState_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceDiagnosisClientInterface_RequestState_Call { - _c.Call.Return(msgCounterType, err) +func (_c *DeviceDiagnosisClientInterface_RequestState_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceDiagnosisClientInterface_RequestState_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -145,3 +133,17 @@ func (_c *DeviceDiagnosisClientInterface_RequestState_Call) RunAndReturn(run fun _c.Call.Return(run) return _c } + +// NewDeviceDiagnosisClientInterface creates a new instance of DeviceDiagnosisClientInterface. 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 NewDeviceDiagnosisClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceDiagnosisClientInterface { + mock := &DeviceDiagnosisClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/DeviceDiagnosisCommonInterface.go b/mocks/DeviceDiagnosisCommonInterface.go index 68533d23..5a7a1da3 100644 --- a/mocks/DeviceDiagnosisCommonInterface.go +++ b/mocks/DeviceDiagnosisCommonInterface.go @@ -1,29 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "time" - - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" -) -// NewDeviceDiagnosisCommonInterface creates a new instance of DeviceDiagnosisCommonInterface. 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 NewDeviceDiagnosisCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceDiagnosisCommonInterface { - mock := &DeviceDiagnosisCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + time "time" +) // DeviceDiagnosisCommonInterface is an autogenerated mock type for the DeviceDiagnosisCommonInterface type type DeviceDiagnosisCommonInterface struct { @@ -38,9 +22,9 @@ func (_m *DeviceDiagnosisCommonInterface) EXPECT() *DeviceDiagnosisCommonInterfa return &DeviceDiagnosisCommonInterface_Expecter{mock: &_m.Mock} } -// GetState provides a mock function for the type DeviceDiagnosisCommonInterface -func (_mock *DeviceDiagnosisCommonInterface) GetState() (*model.DeviceDiagnosisStateDataType, error) { - ret := _mock.Called() +// GetState provides a mock function with no fields +func (_m *DeviceDiagnosisCommonInterface) GetState() (*model.DeviceDiagnosisStateDataType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for GetState") @@ -48,21 +32,23 @@ func (_mock *DeviceDiagnosisCommonInterface) GetState() (*model.DeviceDiagnosisS var r0 *model.DeviceDiagnosisStateDataType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.DeviceDiagnosisStateDataType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.DeviceDiagnosisStateDataType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.DeviceDiagnosisStateDataType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.DeviceDiagnosisStateDataType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceDiagnosisStateDataType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -83,8 +69,8 @@ func (_c *DeviceDiagnosisCommonInterface_GetState_Call) Run(run func()) *DeviceD return _c } -func (_c *DeviceDiagnosisCommonInterface_GetState_Call) Return(deviceDiagnosisStateDataType *model.DeviceDiagnosisStateDataType, err error) *DeviceDiagnosisCommonInterface_GetState_Call { - _c.Call.Return(deviceDiagnosisStateDataType, err) +func (_c *DeviceDiagnosisCommonInterface_GetState_Call) Return(_a0 *model.DeviceDiagnosisStateDataType, _a1 error) *DeviceDiagnosisCommonInterface_GetState_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -93,20 +79,21 @@ func (_c *DeviceDiagnosisCommonInterface_GetState_Call) RunAndReturn(run func() return _c } -// IsHeartbeatWithinDuration provides a mock function for the type DeviceDiagnosisCommonInterface -func (_mock *DeviceDiagnosisCommonInterface) IsHeartbeatWithinDuration(duration time.Duration) bool { - ret := _mock.Called(duration) +// IsHeartbeatWithinDuration provides a mock function with given fields: duration +func (_m *DeviceDiagnosisCommonInterface) IsHeartbeatWithinDuration(duration time.Duration) bool { + ret := _m.Called(duration) if len(ret) == 0 { panic("no return value specified for IsHeartbeatWithinDuration") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(time.Duration) bool); ok { - r0 = returnFunc(duration) + if rf, ok := ret.Get(0).(func(time.Duration) bool); ok { + r0 = rf(duration) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -123,23 +110,31 @@ func (_e *DeviceDiagnosisCommonInterface_Expecter) IsHeartbeatWithinDuration(dur func (_c *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call) Run(run func(duration time.Duration)) *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 time.Duration - if args[0] != nil { - arg0 = args[0].(time.Duration) - } - run( - arg0, - ) + run(args[0].(time.Duration)) }) return _c } -func (_c *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call) Return(b bool) *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call { - _c.Call.Return(b) +func (_c *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call) Return(_a0 bool) *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call { + _c.Call.Return(_a0) return _c } -func (_c *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(duration time.Duration) bool) *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call { +func (_c *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(time.Duration) bool) *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call { _c.Call.Return(run) return _c } + +// NewDeviceDiagnosisCommonInterface creates a new instance of DeviceDiagnosisCommonInterface. 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 NewDeviceDiagnosisCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceDiagnosisCommonInterface { + mock := &DeviceDiagnosisCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/DeviceDiagnosisServerInterface.go b/mocks/DeviceDiagnosisServerInterface.go index f3bda40e..ed83c1b0 100644 --- a/mocks/DeviceDiagnosisServerInterface.go +++ b/mocks/DeviceDiagnosisServerInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewDeviceDiagnosisServerInterface creates a new instance of DeviceDiagnosisServerInterface. 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 NewDeviceDiagnosisServerInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceDiagnosisServerInterface { - mock := &DeviceDiagnosisServerInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // DeviceDiagnosisServerInterface is an autogenerated mock type for the DeviceDiagnosisServerInterface type type DeviceDiagnosisServerInterface struct { mock.Mock @@ -36,10 +20,9 @@ func (_m *DeviceDiagnosisServerInterface) EXPECT() *DeviceDiagnosisServerInterfa return &DeviceDiagnosisServerInterface_Expecter{mock: &_m.Mock} } -// SetLocalOperatingState provides a mock function for the type DeviceDiagnosisServerInterface -func (_mock *DeviceDiagnosisServerInterface) SetLocalOperatingState(operatingState model.DeviceDiagnosisOperatingStateType) { - _mock.Called(operatingState) - return +// SetLocalOperatingState provides a mock function with given fields: operatingState +func (_m *DeviceDiagnosisServerInterface) SetLocalOperatingState(operatingState model.DeviceDiagnosisOperatingStateType) { + _m.Called(operatingState) } // DeviceDiagnosisServerInterface_SetLocalOperatingState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetLocalOperatingState' @@ -55,13 +38,7 @@ func (_e *DeviceDiagnosisServerInterface_Expecter) SetLocalOperatingState(operat func (_c *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call) Run(run func(operatingState model.DeviceDiagnosisOperatingStateType)) *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.DeviceDiagnosisOperatingStateType - if args[0] != nil { - arg0 = args[0].(model.DeviceDiagnosisOperatingStateType) - } - run( - arg0, - ) + run(args[0].(model.DeviceDiagnosisOperatingStateType)) }) return _c } @@ -71,15 +48,14 @@ func (_c *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call) Return() * return _c } -func (_c *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call) RunAndReturn(run func(operatingState model.DeviceDiagnosisOperatingStateType)) *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call { +func (_c *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call) RunAndReturn(run func(model.DeviceDiagnosisOperatingStateType)) *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call { _c.Run(run) return _c } -// SetLocalState provides a mock function for the type DeviceDiagnosisServerInterface -func (_mock *DeviceDiagnosisServerInterface) SetLocalState(statetate *model.DeviceDiagnosisStateDataType) { - _mock.Called(statetate) - return +// SetLocalState provides a mock function with given fields: statetate +func (_m *DeviceDiagnosisServerInterface) SetLocalState(statetate *model.DeviceDiagnosisStateDataType) { + _m.Called(statetate) } // DeviceDiagnosisServerInterface_SetLocalState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetLocalState' @@ -95,13 +71,7 @@ func (_e *DeviceDiagnosisServerInterface_Expecter) SetLocalState(statetate inter func (_c *DeviceDiagnosisServerInterface_SetLocalState_Call) Run(run func(statetate *model.DeviceDiagnosisStateDataType)) *DeviceDiagnosisServerInterface_SetLocalState_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.DeviceDiagnosisStateDataType - if args[0] != nil { - arg0 = args[0].(*model.DeviceDiagnosisStateDataType) - } - run( - arg0, - ) + run(args[0].(*model.DeviceDiagnosisStateDataType)) }) return _c } @@ -111,7 +81,21 @@ func (_c *DeviceDiagnosisServerInterface_SetLocalState_Call) Return() *DeviceDia return _c } -func (_c *DeviceDiagnosisServerInterface_SetLocalState_Call) RunAndReturn(run func(statetate *model.DeviceDiagnosisStateDataType)) *DeviceDiagnosisServerInterface_SetLocalState_Call { +func (_c *DeviceDiagnosisServerInterface_SetLocalState_Call) RunAndReturn(run func(*model.DeviceDiagnosisStateDataType)) *DeviceDiagnosisServerInterface_SetLocalState_Call { _c.Run(run) return _c } + +// NewDeviceDiagnosisServerInterface creates a new instance of DeviceDiagnosisServerInterface. 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 NewDeviceDiagnosisServerInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceDiagnosisServerInterface { + mock := &DeviceDiagnosisServerInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/ElectricalConnectionClientInterface.go b/mocks/ElectricalConnectionClientInterface.go index 71343d3b..e71ec37f 100644 --- a/mocks/ElectricalConnectionClientInterface.go +++ b/mocks/ElectricalConnectionClientInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewElectricalConnectionClientInterface creates a new instance of ElectricalConnectionClientInterface. 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 NewElectricalConnectionClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *ElectricalConnectionClientInterface { - mock := &ElectricalConnectionClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // ElectricalConnectionClientInterface is an autogenerated mock type for the ElectricalConnectionClientInterface type type ElectricalConnectionClientInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *ElectricalConnectionClientInterface) EXPECT() *ElectricalConnectionCli return &ElectricalConnectionClientInterface_Expecter{mock: &_m.Mock} } -// RequestCharacteristics provides a mock function for the type ElectricalConnectionClientInterface -func (_mock *ElectricalConnectionClientInterface) RequestCharacteristics(selector *model.ElectricalConnectionCharacteristicListDataSelectorsType, elements *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestCharacteristics provides a mock function with given fields: selector, elements +func (_m *ElectricalConnectionClientInterface) RequestCharacteristics(selector *model.ElectricalConnectionCharacteristicListDataSelectorsType, elements *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestCharacteristics") @@ -46,21 +30,23 @@ func (_mock *ElectricalConnectionClientInterface) RequestCharacteristics(selecto var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -78,35 +64,24 @@ func (_e *ElectricalConnectionClientInterface_Expecter) RequestCharacteristics(s func (_c *ElectricalConnectionClientInterface_RequestCharacteristics_Call) Run(run func(selector *model.ElectricalConnectionCharacteristicListDataSelectorsType, elements *model.ElectricalConnectionCharacteristicDataElementsType)) *ElectricalConnectionClientInterface_RequestCharacteristics_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.ElectricalConnectionCharacteristicListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.ElectricalConnectionCharacteristicListDataSelectorsType) - } - var arg1 *model.ElectricalConnectionCharacteristicDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.ElectricalConnectionCharacteristicDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.ElectricalConnectionCharacteristicListDataSelectorsType), args[1].(*model.ElectricalConnectionCharacteristicDataElementsType)) }) return _c } -func (_c *ElectricalConnectionClientInterface_RequestCharacteristics_Call) Return(msgCounterType *model.MsgCounterType, err error) *ElectricalConnectionClientInterface_RequestCharacteristics_Call { - _c.Call.Return(msgCounterType, err) +func (_c *ElectricalConnectionClientInterface_RequestCharacteristics_Call) Return(_a0 *model.MsgCounterType, _a1 error) *ElectricalConnectionClientInterface_RequestCharacteristics_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionClientInterface_RequestCharacteristics_Call) RunAndReturn(run func(selector *model.ElectricalConnectionCharacteristicListDataSelectorsType, elements *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestCharacteristics_Call { +func (_c *ElectricalConnectionClientInterface_RequestCharacteristics_Call) RunAndReturn(run func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestCharacteristics_Call { _c.Call.Return(run) return _c } -// RequestDescriptions provides a mock function for the type ElectricalConnectionClientInterface -func (_mock *ElectricalConnectionClientInterface) RequestDescriptions(selector *model.ElectricalConnectionDescriptionListDataSelectorsType, elements *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestDescriptions provides a mock function with given fields: selector, elements +func (_m *ElectricalConnectionClientInterface) RequestDescriptions(selector *model.ElectricalConnectionDescriptionListDataSelectorsType, elements *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestDescriptions") @@ -114,21 +89,23 @@ func (_mock *ElectricalConnectionClientInterface) RequestDescriptions(selector * var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -146,35 +123,24 @@ func (_e *ElectricalConnectionClientInterface_Expecter) RequestDescriptions(sele func (_c *ElectricalConnectionClientInterface_RequestDescriptions_Call) Run(run func(selector *model.ElectricalConnectionDescriptionListDataSelectorsType, elements *model.ElectricalConnectionDescriptionDataElementsType)) *ElectricalConnectionClientInterface_RequestDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.ElectricalConnectionDescriptionListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.ElectricalConnectionDescriptionListDataSelectorsType) - } - var arg1 *model.ElectricalConnectionDescriptionDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.ElectricalConnectionDescriptionDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.ElectricalConnectionDescriptionListDataSelectorsType), args[1].(*model.ElectricalConnectionDescriptionDataElementsType)) }) return _c } -func (_c *ElectricalConnectionClientInterface_RequestDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *ElectricalConnectionClientInterface_RequestDescriptions_Call { - _c.Call.Return(msgCounterType, err) +func (_c *ElectricalConnectionClientInterface_RequestDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *ElectricalConnectionClientInterface_RequestDescriptions_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionClientInterface_RequestDescriptions_Call) RunAndReturn(run func(selector *model.ElectricalConnectionDescriptionListDataSelectorsType, elements *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestDescriptions_Call { +func (_c *ElectricalConnectionClientInterface_RequestDescriptions_Call) RunAndReturn(run func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestDescriptions_Call { _c.Call.Return(run) return _c } -// RequestParameterDescriptions provides a mock function for the type ElectricalConnectionClientInterface -func (_mock *ElectricalConnectionClientInterface) RequestParameterDescriptions(selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType, elements *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestParameterDescriptions provides a mock function with given fields: selector, elements +func (_m *ElectricalConnectionClientInterface) RequestParameterDescriptions(selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType, elements *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestParameterDescriptions") @@ -182,21 +148,23 @@ func (_mock *ElectricalConnectionClientInterface) RequestParameterDescriptions(s var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -214,35 +182,24 @@ func (_e *ElectricalConnectionClientInterface_Expecter) RequestParameterDescript func (_c *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call) Run(run func(selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType, elements *model.ElectricalConnectionParameterDescriptionDataElementsType)) *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.ElectricalConnectionParameterDescriptionListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType) - } - var arg1 *model.ElectricalConnectionParameterDescriptionDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.ElectricalConnectionParameterDescriptionDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType), args[1].(*model.ElectricalConnectionParameterDescriptionDataElementsType)) }) return _c } -func (_c *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call { - _c.Call.Return(msgCounterType, err) +func (_c *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call) RunAndReturn(run func(selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType, elements *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call { +func (_c *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call) RunAndReturn(run func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call { _c.Call.Return(run) return _c } -// RequestPermittedValueSets provides a mock function for the type ElectricalConnectionClientInterface -func (_mock *ElectricalConnectionClientInterface) RequestPermittedValueSets(selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, elements *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestPermittedValueSets provides a mock function with given fields: selector, elements +func (_m *ElectricalConnectionClientInterface) RequestPermittedValueSets(selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, elements *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestPermittedValueSets") @@ -250,21 +207,23 @@ func (_mock *ElectricalConnectionClientInterface) RequestPermittedValueSets(sele var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -282,28 +241,31 @@ func (_e *ElectricalConnectionClientInterface_Expecter) RequestPermittedValueSet func (_c *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call) Run(run func(selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, elements *model.ElectricalConnectionPermittedValueSetDataElementsType)) *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.ElectricalConnectionPermittedValueSetListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType) - } - var arg1 *model.ElectricalConnectionPermittedValueSetDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.ElectricalConnectionPermittedValueSetDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType), args[1].(*model.ElectricalConnectionPermittedValueSetDataElementsType)) }) return _c } -func (_c *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call) Return(msgCounterType *model.MsgCounterType, err error) *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call { - _c.Call.Return(msgCounterType, err) +func (_c *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call) Return(_a0 *model.MsgCounterType, _a1 error) *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call) RunAndReturn(run func(selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, elements *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call { +func (_c *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call) RunAndReturn(run func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call { _c.Call.Return(run) return _c } + +// NewElectricalConnectionClientInterface creates a new instance of ElectricalConnectionClientInterface. 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 NewElectricalConnectionClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *ElectricalConnectionClientInterface { + mock := &ElectricalConnectionClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/ElectricalConnectionCommonInterface.go b/mocks/ElectricalConnectionCommonInterface.go index 1faafc8b..20e466cc 100644 --- a/mocks/ElectricalConnectionCommonInterface.go +++ b/mocks/ElectricalConnectionCommonInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewElectricalConnectionCommonInterface creates a new instance of ElectricalConnectionCommonInterface. 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 NewElectricalConnectionCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *ElectricalConnectionCommonInterface { - mock := &ElectricalConnectionCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // ElectricalConnectionCommonInterface is an autogenerated mock type for the ElectricalConnectionCommonInterface type type ElectricalConnectionCommonInterface struct { mock.Mock @@ -36,20 +20,21 @@ func (_m *ElectricalConnectionCommonInterface) EXPECT() *ElectricalConnectionCom return &ElectricalConnectionCommonInterface_Expecter{mock: &_m.Mock} } -// AdjustValueToBeWithinPermittedValuesForParameterId provides a mock function for the type ElectricalConnectionCommonInterface -func (_mock *ElectricalConnectionCommonInterface) AdjustValueToBeWithinPermittedValuesForParameterId(value float64, parameterId model.ElectricalConnectionParameterIdType) float64 { - ret := _mock.Called(value, parameterId) +// AdjustValueToBeWithinPermittedValuesForParameterId provides a mock function with given fields: value, parameterId +func (_m *ElectricalConnectionCommonInterface) AdjustValueToBeWithinPermittedValuesForParameterId(value float64, parameterId model.ElectricalConnectionParameterIdType) float64 { + ret := _m.Called(value, parameterId) if len(ret) == 0 { panic("no return value specified for AdjustValueToBeWithinPermittedValuesForParameterId") } var r0 float64 - if returnFunc, ok := ret.Get(0).(func(float64, model.ElectricalConnectionParameterIdType) float64); ok { - r0 = returnFunc(value, parameterId) + if rf, ok := ret.Get(0).(func(float64, model.ElectricalConnectionParameterIdType) float64); ok { + r0 = rf(value, parameterId) } else { r0 = ret.Get(0).(float64) } + return r0 } @@ -67,46 +52,36 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) AdjustValueToBeWithinPer func (_c *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Run(run func(value float64, parameterId model.ElectricalConnectionParameterIdType)) *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 model.ElectricalConnectionParameterIdType - if args[1] != nil { - arg1 = args[1].(model.ElectricalConnectionParameterIdType) - } - run( - arg0, - arg1, - ) + run(args[0].(float64), args[1].(model.ElectricalConnectionParameterIdType)) }) return _c } -func (_c *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Return(f float64) *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { - _c.Call.Return(f) +func (_c *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Return(_a0 float64) *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { + _c.Call.Return(_a0) return _c } -func (_c *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) RunAndReturn(run func(value float64, parameterId model.ElectricalConnectionParameterIdType) float64) *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { +func (_c *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) RunAndReturn(run func(float64, model.ElectricalConnectionParameterIdType) float64) *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { _c.Call.Return(run) return _c } -// CheckEventPayloadDataForFilter provides a mock function for the type ElectricalConnectionCommonInterface -func (_mock *ElectricalConnectionCommonInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { - ret := _mock.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter +func (_m *ElectricalConnectionCommonInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { + ret := _m.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { - r0 = returnFunc(payloadData, filter) + if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { + r0 = rf(payloadData, filter) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -116,43 +91,32 @@ type ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call str } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData any -// - filter any +// - payloadData interface{} +// - filter interface{} func (_e *ElectricalConnectionCommonInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { return &ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 any - if args[0] != nil { - arg0 = args[0].(any) - } - var arg1 any - if args[1] != nil { - arg1 = args[1].(any) - } - run( - arg0, - arg1, - ) + run(args[0].(interface{}), args[1].(interface{})) }) return _c } -func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(b) +func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(_a0) return _c } -func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetCharacteristicsForFilter provides a mock function for the type ElectricalConnectionCommonInterface -func (_mock *ElectricalConnectionCommonInterface) GetCharacteristicsForFilter(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error) { - ret := _mock.Called(filter) +// GetCharacteristicsForFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionCommonInterface) GetCharacteristicsForFilter(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetCharacteristicsForFilter") @@ -160,21 +124,23 @@ func (_mock *ElectricalConnectionCommonInterface) GetCharacteristicsForFilter(fi var r0 []model.ElectricalConnectionCharacteristicDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) []model.ElectricalConnectionCharacteristicDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) []model.ElectricalConnectionCharacteristicDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionCharacteristicDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -191,30 +157,24 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetCharacteristicsForFil func (_c *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call) Run(run func(filter model.ElectricalConnectionCharacteristicDataType)) *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionCharacteristicDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionCharacteristicDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionCharacteristicDataType)) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call) Return(electricalConnectionCharacteristicDataTypes []model.ElectricalConnectionCharacteristicDataType, err error) *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call { - _c.Call.Return(electricalConnectionCharacteristicDataTypes, err) +func (_c *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call) Return(_a0 []model.ElectricalConnectionCharacteristicDataType, _a1 error) *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)) *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)) *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call { _c.Call.Return(run) return _c } -// GetDescriptionForParameterDescriptionFilter provides a mock function for the type ElectricalConnectionCommonInterface -func (_mock *ElectricalConnectionCommonInterface) GetDescriptionForParameterDescriptionFilter(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetDescriptionForParameterDescriptionFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionCommonInterface) GetDescriptionForParameterDescriptionFilter(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionForParameterDescriptionFilter") @@ -222,21 +182,23 @@ func (_mock *ElectricalConnectionCommonInterface) GetDescriptionForParameterDesc var r0 *model.ElectricalConnectionDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.ElectricalConnectionDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -253,30 +215,24 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetDescriptionForParamet func (_c *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call) Run(run func(filter model.ElectricalConnectionParameterDescriptionDataType)) *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionParameterDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionParameterDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionParameterDescriptionDataType)) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call) Return(electricalConnectionDescriptionDataType *model.ElectricalConnectionDescriptionDataType, err error) *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call { - _c.Call.Return(electricalConnectionDescriptionDataType, err) +func (_c *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call) Return(_a0 *model.ElectricalConnectionDescriptionDataType, _a1 error) *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call) RunAndReturn(run func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call { _c.Call.Return(run) return _c } -// GetDescriptionsForFilter provides a mock function for the type ElectricalConnectionCommonInterface -func (_mock *ElectricalConnectionCommonInterface) GetDescriptionsForFilter(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetDescriptionsForFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionCommonInterface) GetDescriptionsForFilter(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionsForFilter") @@ -284,21 +240,23 @@ func (_mock *ElectricalConnectionCommonInterface) GetDescriptionsForFilter(filte var r0 []model.ElectricalConnectionDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) []model.ElectricalConnectionDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) []model.ElectricalConnectionDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -315,30 +273,24 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetDescriptionsForFilter func (_c *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call) Run(run func(filter model.ElectricalConnectionDescriptionDataType)) *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionDescriptionDataType)) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call) Return(electricalConnectionDescriptionDataTypes []model.ElectricalConnectionDescriptionDataType, err error) *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call { - _c.Call.Return(electricalConnectionDescriptionDataTypes, err) +func (_c *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call) Return(_a0 []model.ElectricalConnectionDescriptionDataType, _a1 error) *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Return(run) return _c } -// GetParameterDescriptionsForFilter provides a mock function for the type ElectricalConnectionCommonInterface -func (_mock *ElectricalConnectionCommonInterface) GetParameterDescriptionsForFilter(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetParameterDescriptionsForFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionCommonInterface) GetParameterDescriptionsForFilter(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetParameterDescriptionsForFilter") @@ -346,21 +298,23 @@ func (_mock *ElectricalConnectionCommonInterface) GetParameterDescriptionsForFil var r0 []model.ElectricalConnectionParameterDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) []model.ElectricalConnectionParameterDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) []model.ElectricalConnectionParameterDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionParameterDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -377,30 +331,24 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetParameterDescriptions func (_c *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call) Run(run func(filter model.ElectricalConnectionParameterDescriptionDataType)) *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionParameterDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionParameterDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionParameterDescriptionDataType)) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call) Return(electricalConnectionParameterDescriptionDataTypes []model.ElectricalConnectionParameterDescriptionDataType, err error) *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call { - _c.Call.Return(electricalConnectionParameterDescriptionDataTypes, err) +func (_c *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call) Return(_a0 []model.ElectricalConnectionParameterDescriptionDataType, _a1 error) *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call { _c.Call.Return(run) return _c } -// GetPermittedValueDataForFilter provides a mock function for the type ElectricalConnectionCommonInterface -func (_mock *ElectricalConnectionCommonInterface) GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error) { - ret := _mock.Called(filter) +// GetPermittedValueDataForFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionCommonInterface) GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetPermittedValueDataForFilter") @@ -410,29 +358,33 @@ func (_mock *ElectricalConnectionCommonInterface) GetPermittedValueDataForFilter var r1 float64 var r2 float64 var r3 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r0 = rf(filter) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r1 = rf(filter) } else { r1 = ret.Get(1).(float64) } - if returnFunc, ok := ret.Get(2).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r2 = returnFunc(filter) + + if rf, ok := ret.Get(2).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r2 = rf(filter) } else { r2 = ret.Get(2).(float64) } - if returnFunc, ok := ret.Get(3).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { - r3 = returnFunc(filter) + + if rf, ok := ret.Get(3).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { + r3 = rf(filter) } else { r3 = ret.Error(3) } + return r0, r1, r2, r3 } @@ -449,30 +401,24 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetPermittedValueDataFor func (_c *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call) Run(run func(filter model.ElectricalConnectionPermittedValueSetDataType)) *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionPermittedValueSetDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionPermittedValueSetDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionPermittedValueSetDataType)) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call) Return(f float64, f1 float64, f2 float64, err error) *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call { - _c.Call.Return(f, f1, f2, err) +func (_c *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call) Return(_a0 float64, _a1 float64, _a2 float64, _a3 error) *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call { + _c.Call.Return(_a0, _a1, _a2, _a3) return _c } -func (_c *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)) *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)) *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call { _c.Call.Return(run) return _c } -// GetPermittedValueSetForFilter provides a mock function for the type ElectricalConnectionCommonInterface -func (_mock *ElectricalConnectionCommonInterface) GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error) { - ret := _mock.Called(filter) +// GetPermittedValueSetForFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionCommonInterface) GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetPermittedValueSetForFilter") @@ -480,21 +426,23 @@ func (_mock *ElectricalConnectionCommonInterface) GetPermittedValueSetForFilter( var r0 []model.ElectricalConnectionPermittedValueSetDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) []model.ElectricalConnectionPermittedValueSetDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) []model.ElectricalConnectionPermittedValueSetDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionPermittedValueSetDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -511,30 +459,24 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetPermittedValueSetForF func (_c *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call) Run(run func(filter model.ElectricalConnectionPermittedValueSetDataType)) *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionPermittedValueSetDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionPermittedValueSetDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionPermittedValueSetDataType)) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call) Return(electricalConnectionPermittedValueSetDataTypes []model.ElectricalConnectionPermittedValueSetDataType, err error) *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call { - _c.Call.Return(electricalConnectionPermittedValueSetDataTypes, err) +func (_c *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call) Return(_a0 []model.ElectricalConnectionPermittedValueSetDataType, _a1 error) *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)) *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)) *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call { _c.Call.Return(run) return _c } -// GetPhaseCurrentLimits provides a mock function for the type ElectricalConnectionCommonInterface -func (_mock *ElectricalConnectionCommonInterface) GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error) { - ret := _mock.Called(measDesc) +// GetPhaseCurrentLimits provides a mock function with given fields: measDesc +func (_m *ElectricalConnectionCommonInterface) GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error) { + ret := _m.Called(measDesc) if len(ret) == 0 { panic("no return value specified for GetPhaseCurrentLimits") @@ -544,35 +486,39 @@ func (_mock *ElectricalConnectionCommonInterface) GetPhaseCurrentLimits(measDesc var r1 []float64 var r2 []float64 var r3 error - if returnFunc, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)); ok { - return returnFunc(measDesc) + if rf, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)); ok { + return rf(measDesc) } - if returnFunc, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r0 = returnFunc(measDesc) + if rf, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r0 = rf(measDesc) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - if returnFunc, ok := ret.Get(1).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r1 = returnFunc(measDesc) + + if rf, ok := ret.Get(1).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r1 = rf(measDesc) } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]float64) } } - if returnFunc, ok := ret.Get(2).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r2 = returnFunc(measDesc) + + if rf, ok := ret.Get(2).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r2 = rf(measDesc) } else { if ret.Get(2) != nil { r2 = ret.Get(2).([]float64) } } - if returnFunc, ok := ret.Get(3).(func([]model.MeasurementDescriptionDataType) error); ok { - r3 = returnFunc(measDesc) + + if rf, ok := ret.Get(3).(func([]model.MeasurementDescriptionDataType) error); ok { + r3 = rf(measDesc) } else { r3 = ret.Error(3) } + return r0, r1, r2, r3 } @@ -589,13 +535,7 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetPhaseCurrentLimits(me func (_c *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call) Run(run func(measDesc []model.MeasurementDescriptionDataType)) *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []model.MeasurementDescriptionDataType - if args[0] != nil { - arg0 = args[0].([]model.MeasurementDescriptionDataType) - } - run( - arg0, - ) + run(args[0].([]model.MeasurementDescriptionDataType)) }) return _c } @@ -605,7 +545,21 @@ func (_c *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call) Return return _c } -func (_c *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call) RunAndReturn(run func(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)) *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call { +func (_c *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call) RunAndReturn(run func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)) *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call { _c.Call.Return(run) return _c } + +// NewElectricalConnectionCommonInterface creates a new instance of ElectricalConnectionCommonInterface. 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 NewElectricalConnectionCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *ElectricalConnectionCommonInterface { + mock := &ElectricalConnectionCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/ElectricalConnectionServerInterface.go b/mocks/ElectricalConnectionServerInterface.go index 101b49b3..4443bd8c 100644 --- a/mocks/ElectricalConnectionServerInterface.go +++ b/mocks/ElectricalConnectionServerInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/model" + api "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) - -// NewElectricalConnectionServerInterface creates a new instance of ElectricalConnectionServerInterface. 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 NewElectricalConnectionServerInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *ElectricalConnectionServerInterface { - mock := &ElectricalConnectionServerInterface{} - mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + model "github.com/enbility/spine-go/model" +) // ElectricalConnectionServerInterface is an autogenerated mock type for the ElectricalConnectionServerInterface type type ElectricalConnectionServerInterface struct { @@ -37,9 +22,9 @@ func (_m *ElectricalConnectionServerInterface) EXPECT() *ElectricalConnectionSer return &ElectricalConnectionServerInterface_Expecter{mock: &_m.Mock} } -// AddCharacteristic provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) AddCharacteristic(data model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error) { - ret := _mock.Called(data) +// AddCharacteristic provides a mock function with given fields: data +func (_m *ElectricalConnectionServerInterface) AddCharacteristic(data model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error) { + ret := _m.Called(data) if len(ret) == 0 { panic("no return value specified for AddCharacteristic") @@ -47,21 +32,23 @@ func (_mock *ElectricalConnectionServerInterface) AddCharacteristic(data model.E var r0 *model.ElectricalConnectionCharacteristicIdType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error)); ok { - return returnFunc(data) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error)); ok { + return rf(data) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) *model.ElectricalConnectionCharacteristicIdType); ok { - r0 = returnFunc(data) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) *model.ElectricalConnectionCharacteristicIdType); ok { + r0 = rf(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.ElectricalConnectionCharacteristicIdType) } } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { - r1 = returnFunc(data) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { + r1 = rf(data) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -78,41 +65,36 @@ func (_e *ElectricalConnectionServerInterface_Expecter) AddCharacteristic(data i func (_c *ElectricalConnectionServerInterface_AddCharacteristic_Call) Run(run func(data model.ElectricalConnectionCharacteristicDataType)) *ElectricalConnectionServerInterface_AddCharacteristic_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionCharacteristicDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionCharacteristicDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionCharacteristicDataType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_AddCharacteristic_Call) Return(electricalConnectionCharacteristicIdType *model.ElectricalConnectionCharacteristicIdType, err error) *ElectricalConnectionServerInterface_AddCharacteristic_Call { - _c.Call.Return(electricalConnectionCharacteristicIdType, err) +func (_c *ElectricalConnectionServerInterface_AddCharacteristic_Call) Return(_a0 *model.ElectricalConnectionCharacteristicIdType, _a1 error) *ElectricalConnectionServerInterface_AddCharacteristic_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionServerInterface_AddCharacteristic_Call) RunAndReturn(run func(data model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error)) *ElectricalConnectionServerInterface_AddCharacteristic_Call { +func (_c *ElectricalConnectionServerInterface_AddCharacteristic_Call) RunAndReturn(run func(model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error)) *ElectricalConnectionServerInterface_AddCharacteristic_Call { _c.Call.Return(run) return _c } -// AddDescription provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) AddDescription(description model.ElectricalConnectionDescriptionDataType) error { - ret := _mock.Called(description) +// AddDescription provides a mock function with given fields: description +func (_m *ElectricalConnectionServerInterface) AddDescription(description model.ElectricalConnectionDescriptionDataType) error { + ret := _m.Called(description) if len(ret) == 0 { panic("no return value specified for AddDescription") } var r0 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) error); ok { - r0 = returnFunc(description) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) error); ok { + r0 = rf(description) } else { r0 = ret.Error(0) } + return r0 } @@ -129,43 +111,38 @@ func (_e *ElectricalConnectionServerInterface_Expecter) AddDescription(descripti func (_c *ElectricalConnectionServerInterface_AddDescription_Call) Run(run func(description model.ElectricalConnectionDescriptionDataType)) *ElectricalConnectionServerInterface_AddDescription_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionDescriptionDataType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_AddDescription_Call) Return(err error) *ElectricalConnectionServerInterface_AddDescription_Call { - _c.Call.Return(err) +func (_c *ElectricalConnectionServerInterface_AddDescription_Call) Return(_a0 error) *ElectricalConnectionServerInterface_AddDescription_Call { + _c.Call.Return(_a0) return _c } -func (_c *ElectricalConnectionServerInterface_AddDescription_Call) RunAndReturn(run func(description model.ElectricalConnectionDescriptionDataType) error) *ElectricalConnectionServerInterface_AddDescription_Call { +func (_c *ElectricalConnectionServerInterface_AddDescription_Call) RunAndReturn(run func(model.ElectricalConnectionDescriptionDataType) error) *ElectricalConnectionServerInterface_AddDescription_Call { _c.Call.Return(run) return _c } -// AddParameterDescription provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) AddParameterDescription(description model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType { - ret := _mock.Called(description) +// AddParameterDescription provides a mock function with given fields: description +func (_m *ElectricalConnectionServerInterface) AddParameterDescription(description model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType { + ret := _m.Called(description) if len(ret) == 0 { panic("no return value specified for AddParameterDescription") } var r0 *model.ElectricalConnectionParameterIdType - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType); ok { - r0 = returnFunc(description) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType); ok { + r0 = rf(description) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.ElectricalConnectionParameterIdType) } } + return r0 } @@ -182,41 +159,36 @@ func (_e *ElectricalConnectionServerInterface_Expecter) AddParameterDescription( func (_c *ElectricalConnectionServerInterface_AddParameterDescription_Call) Run(run func(description model.ElectricalConnectionParameterDescriptionDataType)) *ElectricalConnectionServerInterface_AddParameterDescription_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionParameterDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionParameterDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionParameterDescriptionDataType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_AddParameterDescription_Call) Return(electricalConnectionParameterIdType *model.ElectricalConnectionParameterIdType) *ElectricalConnectionServerInterface_AddParameterDescription_Call { - _c.Call.Return(electricalConnectionParameterIdType) +func (_c *ElectricalConnectionServerInterface_AddParameterDescription_Call) Return(_a0 *model.ElectricalConnectionParameterIdType) *ElectricalConnectionServerInterface_AddParameterDescription_Call { + _c.Call.Return(_a0) return _c } -func (_c *ElectricalConnectionServerInterface_AddParameterDescription_Call) RunAndReturn(run func(description model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType) *ElectricalConnectionServerInterface_AddParameterDescription_Call { +func (_c *ElectricalConnectionServerInterface_AddParameterDescription_Call) RunAndReturn(run func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType) *ElectricalConnectionServerInterface_AddParameterDescription_Call { _c.Call.Return(run) return _c } -// AdjustValueToBeWithinPermittedValuesForParameterId provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) AdjustValueToBeWithinPermittedValuesForParameterId(value float64, parameterId model.ElectricalConnectionParameterIdType) float64 { - ret := _mock.Called(value, parameterId) +// AdjustValueToBeWithinPermittedValuesForParameterId provides a mock function with given fields: value, parameterId +func (_m *ElectricalConnectionServerInterface) AdjustValueToBeWithinPermittedValuesForParameterId(value float64, parameterId model.ElectricalConnectionParameterIdType) float64 { + ret := _m.Called(value, parameterId) if len(ret) == 0 { panic("no return value specified for AdjustValueToBeWithinPermittedValuesForParameterId") } var r0 float64 - if returnFunc, ok := ret.Get(0).(func(float64, model.ElectricalConnectionParameterIdType) float64); ok { - r0 = returnFunc(value, parameterId) + if rf, ok := ret.Get(0).(func(float64, model.ElectricalConnectionParameterIdType) float64); ok { + r0 = rf(value, parameterId) } else { r0 = ret.Get(0).(float64) } + return r0 } @@ -234,46 +206,36 @@ func (_e *ElectricalConnectionServerInterface_Expecter) AdjustValueToBeWithinPer func (_c *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Run(run func(value float64, parameterId model.ElectricalConnectionParameterIdType)) *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 model.ElectricalConnectionParameterIdType - if args[1] != nil { - arg1 = args[1].(model.ElectricalConnectionParameterIdType) - } - run( - arg0, - arg1, - ) + run(args[0].(float64), args[1].(model.ElectricalConnectionParameterIdType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Return(f float64) *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { - _c.Call.Return(f) +func (_c *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Return(_a0 float64) *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { + _c.Call.Return(_a0) return _c } -func (_c *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) RunAndReturn(run func(value float64, parameterId model.ElectricalConnectionParameterIdType) float64) *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { +func (_c *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) RunAndReturn(run func(float64, model.ElectricalConnectionParameterIdType) float64) *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { _c.Call.Return(run) return _c } -// CheckEventPayloadDataForFilter provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { - ret := _mock.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter +func (_m *ElectricalConnectionServerInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { + ret := _m.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { - r0 = returnFunc(payloadData, filter) + if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { + r0 = rf(payloadData, filter) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -283,43 +245,32 @@ type ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call str } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData any -// - filter any +// - payloadData interface{} +// - filter interface{} func (_e *ElectricalConnectionServerInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { return &ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { +func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 any - if args[0] != nil { - arg0 = args[0].(any) - } - var arg1 any - if args[1] != nil { - arg1 = args[1].(any) - } - run( - arg0, - arg1, - ) + run(args[0].(interface{}), args[1].(interface{})) }) return _c } -func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(b) +func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(_a0) return _c } -func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { +func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetCharacteristicsForFilter provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) GetCharacteristicsForFilter(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error) { - ret := _mock.Called(filter) +// GetCharacteristicsForFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionServerInterface) GetCharacteristicsForFilter(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetCharacteristicsForFilter") @@ -327,21 +278,23 @@ func (_mock *ElectricalConnectionServerInterface) GetCharacteristicsForFilter(fi var r0 []model.ElectricalConnectionCharacteristicDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) []model.ElectricalConnectionCharacteristicDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) []model.ElectricalConnectionCharacteristicDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionCharacteristicDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -358,30 +311,24 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetCharacteristicsForFil func (_c *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call) Run(run func(filter model.ElectricalConnectionCharacteristicDataType)) *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionCharacteristicDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionCharacteristicDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionCharacteristicDataType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call) Return(electricalConnectionCharacteristicDataTypes []model.ElectricalConnectionCharacteristicDataType, err error) *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call { - _c.Call.Return(electricalConnectionCharacteristicDataTypes, err) +func (_c *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call) Return(_a0 []model.ElectricalConnectionCharacteristicDataType, _a1 error) *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)) *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)) *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call { _c.Call.Return(run) return _c } -// GetDescriptionForParameterDescriptionFilter provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) GetDescriptionForParameterDescriptionFilter(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetDescriptionForParameterDescriptionFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionServerInterface) GetDescriptionForParameterDescriptionFilter(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionForParameterDescriptionFilter") @@ -389,21 +336,23 @@ func (_mock *ElectricalConnectionServerInterface) GetDescriptionForParameterDesc var r0 *model.ElectricalConnectionDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.ElectricalConnectionDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -420,30 +369,24 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetDescriptionForParamet func (_c *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call) Run(run func(filter model.ElectricalConnectionParameterDescriptionDataType)) *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionParameterDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionParameterDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionParameterDescriptionDataType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call) Return(electricalConnectionDescriptionDataType *model.ElectricalConnectionDescriptionDataType, err error) *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call { - _c.Call.Return(electricalConnectionDescriptionDataType, err) +func (_c *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call) Return(_a0 *model.ElectricalConnectionDescriptionDataType, _a1 error) *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call) RunAndReturn(run func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call { _c.Call.Return(run) return _c } -// GetDescriptionsForFilter provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) GetDescriptionsForFilter(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetDescriptionsForFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionServerInterface) GetDescriptionsForFilter(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionsForFilter") @@ -451,21 +394,23 @@ func (_mock *ElectricalConnectionServerInterface) GetDescriptionsForFilter(filte var r0 []model.ElectricalConnectionDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) []model.ElectricalConnectionDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) []model.ElectricalConnectionDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -482,30 +427,82 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetDescriptionsForFilter func (_c *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call) Run(run func(filter model.ElectricalConnectionDescriptionDataType)) *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionDescriptionDataType) + run(args[0].(model.ElectricalConnectionDescriptionDataType)) + }) + return _c +} + +func (_c *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call) Return(_a0 []model.ElectricalConnectionDescriptionDataType, _a1 error) *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call { + _c.Call.Return(run) + return _c +} + +// GetOrAddIdForDescription provides a mock function with given fields: electricalConnectionDescription +func (_m *ElectricalConnectionServerInterface) GetOrAddIdForDescription(electricalConnectionDescription model.ElectricalConnectionDescriptionDataType) (*model.ElectricalConnectionIdType, error) { + ret := _m.Called(electricalConnectionDescription) + + if len(ret) == 0 { + panic("no return value specified for GetOrAddIdForDescription") + } + + var r0 *model.ElectricalConnectionIdType + var r1 error + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) (*model.ElectricalConnectionIdType, error)); ok { + return rf(electricalConnectionDescription) + } + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) *model.ElectricalConnectionIdType); ok { + r0 = rf(electricalConnectionDescription) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*model.ElectricalConnectionIdType) } - run( - arg0, - ) + } + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok { + r1 = rf(electricalConnectionDescription) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOrAddIdForDescription' +type ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call struct { + *mock.Call +} + +// GetOrAddIdForDescription is a helper method to define mock.On call +// - electricalConnectionDescription model.ElectricalConnectionDescriptionDataType +func (_e *ElectricalConnectionServerInterface_Expecter) GetOrAddIdForDescription(electricalConnectionDescription interface{}) *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call { + return &ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call{Call: _e.mock.On("GetOrAddIdForDescription", electricalConnectionDescription)} +} + +func (_c *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call) Run(run func(electricalConnectionDescription model.ElectricalConnectionDescriptionDataType)) *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(model.ElectricalConnectionDescriptionDataType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call) Return(electricalConnectionDescriptionDataTypes []model.ElectricalConnectionDescriptionDataType, err error) *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call { - _c.Call.Return(electricalConnectionDescriptionDataTypes, err) +func (_c *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call) Return(_a0 *model.ElectricalConnectionIdType, _a1 error) *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call) RunAndReturn(run func(model.ElectricalConnectionDescriptionDataType) (*model.ElectricalConnectionIdType, error)) *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call { _c.Call.Return(run) return _c } -// GetParameterDescriptionsForFilter provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) GetParameterDescriptionsForFilter(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetParameterDescriptionsForFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionServerInterface) GetParameterDescriptionsForFilter(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetParameterDescriptionsForFilter") @@ -513,21 +510,23 @@ func (_mock *ElectricalConnectionServerInterface) GetParameterDescriptionsForFil var r0 []model.ElectricalConnectionParameterDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) []model.ElectricalConnectionParameterDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) []model.ElectricalConnectionParameterDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionParameterDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -544,30 +543,24 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetParameterDescriptions func (_c *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call) Run(run func(filter model.ElectricalConnectionParameterDescriptionDataType)) *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionParameterDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionParameterDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionParameterDescriptionDataType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call) Return(electricalConnectionParameterDescriptionDataTypes []model.ElectricalConnectionParameterDescriptionDataType, err error) *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call { - _c.Call.Return(electricalConnectionParameterDescriptionDataTypes, err) +func (_c *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call) Return(_a0 []model.ElectricalConnectionParameterDescriptionDataType, _a1 error) *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call { _c.Call.Return(run) return _c } -// GetPermittedValueDataForFilter provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error) { - ret := _mock.Called(filter) +// GetPermittedValueDataForFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionServerInterface) GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetPermittedValueDataForFilter") @@ -577,29 +570,33 @@ func (_mock *ElectricalConnectionServerInterface) GetPermittedValueDataForFilter var r1 float64 var r2 float64 var r3 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r0 = rf(filter) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r1 = rf(filter) } else { r1 = ret.Get(1).(float64) } - if returnFunc, ok := ret.Get(2).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r2 = returnFunc(filter) + + if rf, ok := ret.Get(2).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r2 = rf(filter) } else { r2 = ret.Get(2).(float64) } - if returnFunc, ok := ret.Get(3).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { - r3 = returnFunc(filter) + + if rf, ok := ret.Get(3).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { + r3 = rf(filter) } else { r3 = ret.Error(3) } + return r0, r1, r2, r3 } @@ -616,30 +613,24 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetPermittedValueDataFor func (_c *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call) Run(run func(filter model.ElectricalConnectionPermittedValueSetDataType)) *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionPermittedValueSetDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionPermittedValueSetDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionPermittedValueSetDataType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call) Return(f float64, f1 float64, f2 float64, err error) *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call { - _c.Call.Return(f, f1, f2, err) +func (_c *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call) Return(_a0 float64, _a1 float64, _a2 float64, _a3 error) *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call { + _c.Call.Return(_a0, _a1, _a2, _a3) return _c } -func (_c *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)) *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)) *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call { _c.Call.Return(run) return _c } -// GetPermittedValueSetForFilter provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error) { - ret := _mock.Called(filter) +// GetPermittedValueSetForFilter provides a mock function with given fields: filter +func (_m *ElectricalConnectionServerInterface) GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetPermittedValueSetForFilter") @@ -647,21 +638,23 @@ func (_mock *ElectricalConnectionServerInterface) GetPermittedValueSetForFilter( var r0 []model.ElectricalConnectionPermittedValueSetDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) []model.ElectricalConnectionPermittedValueSetDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) []model.ElectricalConnectionPermittedValueSetDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionPermittedValueSetDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -678,30 +671,24 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetPermittedValueSetForF func (_c *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call) Run(run func(filter model.ElectricalConnectionPermittedValueSetDataType)) *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionPermittedValueSetDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionPermittedValueSetDataType) - } - run( - arg0, - ) + run(args[0].(model.ElectricalConnectionPermittedValueSetDataType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call) Return(electricalConnectionPermittedValueSetDataTypes []model.ElectricalConnectionPermittedValueSetDataType, err error) *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call { - _c.Call.Return(electricalConnectionPermittedValueSetDataTypes, err) +func (_c *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call) Return(_a0 []model.ElectricalConnectionPermittedValueSetDataType, _a1 error) *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)) *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)) *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call { _c.Call.Return(run) return _c } -// GetPhaseCurrentLimits provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error) { - ret := _mock.Called(measDesc) +// GetPhaseCurrentLimits provides a mock function with given fields: measDesc +func (_m *ElectricalConnectionServerInterface) GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error) { + ret := _m.Called(measDesc) if len(ret) == 0 { panic("no return value specified for GetPhaseCurrentLimits") @@ -711,35 +698,39 @@ func (_mock *ElectricalConnectionServerInterface) GetPhaseCurrentLimits(measDesc var r1 []float64 var r2 []float64 var r3 error - if returnFunc, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)); ok { - return returnFunc(measDesc) + if rf, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)); ok { + return rf(measDesc) } - if returnFunc, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r0 = returnFunc(measDesc) + if rf, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r0 = rf(measDesc) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - if returnFunc, ok := ret.Get(1).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r1 = returnFunc(measDesc) + + if rf, ok := ret.Get(1).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r1 = rf(measDesc) } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]float64) } } - if returnFunc, ok := ret.Get(2).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r2 = returnFunc(measDesc) + + if rf, ok := ret.Get(2).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r2 = rf(measDesc) } else { if ret.Get(2) != nil { r2 = ret.Get(2).([]float64) } } - if returnFunc, ok := ret.Get(3).(func([]model.MeasurementDescriptionDataType) error); ok { - r3 = returnFunc(measDesc) + + if rf, ok := ret.Get(3).(func([]model.MeasurementDescriptionDataType) error); ok { + r3 = rf(measDesc) } else { r3 = ret.Error(3) } + return r0, r1, r2, r3 } @@ -756,13 +747,7 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetPhaseCurrentLimits(me func (_c *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call) Run(run func(measDesc []model.MeasurementDescriptionDataType)) *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []model.MeasurementDescriptionDataType - if args[0] != nil { - arg0 = args[0].([]model.MeasurementDescriptionDataType) - } - run( - arg0, - ) + run(args[0].([]model.MeasurementDescriptionDataType)) }) return _c } @@ -772,25 +757,26 @@ func (_c *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call) Return return _c } -func (_c *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call) RunAndReturn(run func(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)) *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call { +func (_c *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call) RunAndReturn(run func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)) *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call { _c.Call.Return(run) return _c } -// UpdateCharacteristic provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) UpdateCharacteristic(data model.ElectricalConnectionCharacteristicDataType, deleteElements *model.ElectricalConnectionCharacteristicDataElementsType) error { - ret := _mock.Called(data, deleteElements) +// UpdateCharacteristic provides a mock function with given fields: data, deleteElements +func (_m *ElectricalConnectionServerInterface) UpdateCharacteristic(data model.ElectricalConnectionCharacteristicDataType, deleteElements *model.ElectricalConnectionCharacteristicDataElementsType) error { + ret := _m.Called(data, deleteElements) if len(ret) == 0 { panic("no return value specified for UpdateCharacteristic") } var r0 error - if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType, *model.ElectricalConnectionCharacteristicDataElementsType) error); ok { - r0 = returnFunc(data, deleteElements) + if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType, *model.ElectricalConnectionCharacteristicDataElementsType) error); ok { + r0 = rf(data, deleteElements) } else { r0 = ret.Error(0) } + return r0 } @@ -808,46 +794,36 @@ func (_e *ElectricalConnectionServerInterface_Expecter) UpdateCharacteristic(dat func (_c *ElectricalConnectionServerInterface_UpdateCharacteristic_Call) Run(run func(data model.ElectricalConnectionCharacteristicDataType, deleteElements *model.ElectricalConnectionCharacteristicDataElementsType)) *ElectricalConnectionServerInterface_UpdateCharacteristic_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.ElectricalConnectionCharacteristicDataType - if args[0] != nil { - arg0 = args[0].(model.ElectricalConnectionCharacteristicDataType) - } - var arg1 *model.ElectricalConnectionCharacteristicDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.ElectricalConnectionCharacteristicDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(model.ElectricalConnectionCharacteristicDataType), args[1].(*model.ElectricalConnectionCharacteristicDataElementsType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_UpdateCharacteristic_Call) Return(err error) *ElectricalConnectionServerInterface_UpdateCharacteristic_Call { - _c.Call.Return(err) +func (_c *ElectricalConnectionServerInterface_UpdateCharacteristic_Call) Return(_a0 error) *ElectricalConnectionServerInterface_UpdateCharacteristic_Call { + _c.Call.Return(_a0) return _c } -func (_c *ElectricalConnectionServerInterface_UpdateCharacteristic_Call) RunAndReturn(run func(data model.ElectricalConnectionCharacteristicDataType, deleteElements *model.ElectricalConnectionCharacteristicDataElementsType) error) *ElectricalConnectionServerInterface_UpdateCharacteristic_Call { +func (_c *ElectricalConnectionServerInterface_UpdateCharacteristic_Call) RunAndReturn(run func(model.ElectricalConnectionCharacteristicDataType, *model.ElectricalConnectionCharacteristicDataElementsType) error) *ElectricalConnectionServerInterface_UpdateCharacteristic_Call { _c.Call.Return(run) return _c } -// UpdatePermittedValueSetForFilters provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) UpdatePermittedValueSetForFilters(data []api.ElectricalConnectionPermittedValueSetForFilter, deleteSelector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, deleteElements *model.ElectricalConnectionPermittedValueSetDataElementsType) error { - ret := _mock.Called(data, deleteSelector, deleteElements) +// UpdatePermittedValueSetForFilters provides a mock function with given fields: data, deleteSelector, deleteElements +func (_m *ElectricalConnectionServerInterface) UpdatePermittedValueSetForFilters(data []api.ElectricalConnectionPermittedValueSetForFilter, deleteSelector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, deleteElements *model.ElectricalConnectionPermittedValueSetDataElementsType) error { + ret := _m.Called(data, deleteSelector, deleteElements) if len(ret) == 0 { panic("no return value specified for UpdatePermittedValueSetForFilters") } var r0 error - if returnFunc, ok := ret.Get(0).(func([]api.ElectricalConnectionPermittedValueSetForFilter, *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) error); ok { - r0 = returnFunc(data, deleteSelector, deleteElements) + if rf, ok := ret.Get(0).(func([]api.ElectricalConnectionPermittedValueSetForFilter, *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) error); ok { + r0 = rf(data, deleteSelector, deleteElements) } else { r0 = ret.Error(0) } + return r0 } @@ -866,51 +842,36 @@ func (_e *ElectricalConnectionServerInterface_Expecter) UpdatePermittedValueSetF func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call) Run(run func(data []api.ElectricalConnectionPermittedValueSetForFilter, deleteSelector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, deleteElements *model.ElectricalConnectionPermittedValueSetDataElementsType)) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []api.ElectricalConnectionPermittedValueSetForFilter - if args[0] != nil { - arg0 = args[0].([]api.ElectricalConnectionPermittedValueSetForFilter) - } - var arg1 *model.ElectricalConnectionPermittedValueSetListDataSelectorsType - if args[1] != nil { - arg1 = args[1].(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType) - } - var arg2 *model.ElectricalConnectionPermittedValueSetDataElementsType - if args[2] != nil { - arg2 = args[2].(*model.ElectricalConnectionPermittedValueSetDataElementsType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].([]api.ElectricalConnectionPermittedValueSetForFilter), args[1].(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType), args[2].(*model.ElectricalConnectionPermittedValueSetDataElementsType)) }) return _c } -func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call) Return(err error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call { - _c.Call.Return(err) +func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call) Return(_a0 error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call { + _c.Call.Return(_a0) return _c } -func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call) RunAndReturn(run func(data []api.ElectricalConnectionPermittedValueSetForFilter, deleteSelector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, deleteElements *model.ElectricalConnectionPermittedValueSetDataElementsType) error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call { +func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call) RunAndReturn(run func([]api.ElectricalConnectionPermittedValueSetForFilter, *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call { _c.Call.Return(run) return _c } -// UpdatePermittedValueSetForIds provides a mock function for the type ElectricalConnectionServerInterface -func (_mock *ElectricalConnectionServerInterface) UpdatePermittedValueSetForIds(data []api.ElectricalConnectionPermittedValueSetForID) error { - ret := _mock.Called(data) +// UpdatePermittedValueSetForIds provides a mock function with given fields: data +func (_m *ElectricalConnectionServerInterface) UpdatePermittedValueSetForIds(data []api.ElectricalConnectionPermittedValueSetForID) error { + ret := _m.Called(data) if len(ret) == 0 { panic("no return value specified for UpdatePermittedValueSetForIds") } var r0 error - if returnFunc, ok := ret.Get(0).(func([]api.ElectricalConnectionPermittedValueSetForID) error); ok { - r0 = returnFunc(data) + if rf, ok := ret.Get(0).(func([]api.ElectricalConnectionPermittedValueSetForID) error); ok { + r0 = rf(data) } else { r0 = ret.Error(0) } + return r0 } @@ -927,23 +888,31 @@ func (_e *ElectricalConnectionServerInterface_Expecter) UpdatePermittedValueSetF func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call) Run(run func(data []api.ElectricalConnectionPermittedValueSetForID)) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []api.ElectricalConnectionPermittedValueSetForID - if args[0] != nil { - arg0 = args[0].([]api.ElectricalConnectionPermittedValueSetForID) - } - run( - arg0, - ) + run(args[0].([]api.ElectricalConnectionPermittedValueSetForID)) }) return _c } -func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call) Return(err error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call { - _c.Call.Return(err) +func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call) Return(_a0 error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call { + _c.Call.Return(_a0) return _c } -func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call) RunAndReturn(run func(data []api.ElectricalConnectionPermittedValueSetForID) error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call { +func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call) RunAndReturn(run func([]api.ElectricalConnectionPermittedValueSetForID) error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call { _c.Call.Return(run) return _c } + +// NewElectricalConnectionServerInterface creates a new instance of ElectricalConnectionServerInterface. 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 NewElectricalConnectionServerInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *ElectricalConnectionServerInterface { + mock := &ElectricalConnectionServerInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/EntityEventCallback.go b/mocks/EntityEventCallback.go index c1b5b914..b0dd293f 100644 --- a/mocks/EntityEventCallback.go +++ b/mocks/EntityEventCallback.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.46.3. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks @@ -54,7 +54,7 @@ func (_c *EntityEventCallback_Execute_Call) Return() *EntityEventCallback_Execut } func (_c *EntityEventCallback_Execute_Call) RunAndReturn(run func(string, api.DeviceRemoteInterface, api.EntityRemoteInterface, eebus_goapi.EventType)) *EntityEventCallback_Execute_Call { - _c.Call.Return(run) + _c.Run(run) return _c } diff --git a/mocks/FeatureClientInterface.go b/mocks/FeatureClientInterface.go index dac163c1..c6bc5ba7 100644 --- a/mocks/FeatureClientInterface.go +++ b/mocks/FeatureClientInterface.go @@ -1,28 +1,14 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/api" - "github.com/enbility/spine-go/model" - mock "github.com/stretchr/testify/mock" -) - -// NewFeatureClientInterface creates a new instance of FeatureClientInterface. 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 NewFeatureClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *FeatureClientInterface { - mock := &FeatureClientInterface{} - mock.Mock.Test(t) + api "github.com/enbility/spine-go/api" - t.Cleanup(func() { mock.AssertExpectations(t) }) + mock "github.com/stretchr/testify/mock" - return mock -} + model "github.com/enbility/spine-go/model" +) // FeatureClientInterface is an autogenerated mock type for the FeatureClientInterface type type FeatureClientInterface struct { @@ -37,20 +23,21 @@ func (_m *FeatureClientInterface) EXPECT() *FeatureClientInterface_Expecter { return &FeatureClientInterface_Expecter{mock: &_m.Mock} } -// AddResponseCallback provides a mock function for the type FeatureClientInterface -func (_mock *FeatureClientInterface) AddResponseCallback(msgCounterReference model.MsgCounterType, function func(msg api.ResponseMessage)) error { - ret := _mock.Called(msgCounterReference, function) +// AddResponseCallback provides a mock function with given fields: msgCounterReference, function +func (_m *FeatureClientInterface) AddResponseCallback(msgCounterReference model.MsgCounterType, function func(api.ResponseMessage)) error { + ret := _m.Called(msgCounterReference, function) if len(ret) == 0 { panic("no return value specified for AddResponseCallback") } var r0 error - if returnFunc, ok := ret.Get(0).(func(model.MsgCounterType, func(msg api.ResponseMessage)) error); ok { - r0 = returnFunc(msgCounterReference, function) + if rf, ok := ret.Get(0).(func(model.MsgCounterType, func(api.ResponseMessage)) error); ok { + r0 = rf(msgCounterReference, function) } else { r0 = ret.Error(0) } + return r0 } @@ -61,43 +48,31 @@ type FeatureClientInterface_AddResponseCallback_Call struct { // AddResponseCallback is a helper method to define mock.On call // - msgCounterReference model.MsgCounterType -// - function func(msg api.ResponseMessage) +// - function func(api.ResponseMessage) func (_e *FeatureClientInterface_Expecter) AddResponseCallback(msgCounterReference interface{}, function interface{}) *FeatureClientInterface_AddResponseCallback_Call { return &FeatureClientInterface_AddResponseCallback_Call{Call: _e.mock.On("AddResponseCallback", msgCounterReference, function)} } -func (_c *FeatureClientInterface_AddResponseCallback_Call) Run(run func(msgCounterReference model.MsgCounterType, function func(msg api.ResponseMessage))) *FeatureClientInterface_AddResponseCallback_Call { +func (_c *FeatureClientInterface_AddResponseCallback_Call) Run(run func(msgCounterReference model.MsgCounterType, function func(api.ResponseMessage))) *FeatureClientInterface_AddResponseCallback_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.MsgCounterType - if args[0] != nil { - arg0 = args[0].(model.MsgCounterType) - } - var arg1 func(msg api.ResponseMessage) - if args[1] != nil { - arg1 = args[1].(func(msg api.ResponseMessage)) - } - run( - arg0, - arg1, - ) + run(args[0].(model.MsgCounterType), args[1].(func(api.ResponseMessage))) }) return _c } -func (_c *FeatureClientInterface_AddResponseCallback_Call) Return(err error) *FeatureClientInterface_AddResponseCallback_Call { - _c.Call.Return(err) +func (_c *FeatureClientInterface_AddResponseCallback_Call) Return(_a0 error) *FeatureClientInterface_AddResponseCallback_Call { + _c.Call.Return(_a0) return _c } -func (_c *FeatureClientInterface_AddResponseCallback_Call) RunAndReturn(run func(msgCounterReference model.MsgCounterType, function func(msg api.ResponseMessage)) error) *FeatureClientInterface_AddResponseCallback_Call { +func (_c *FeatureClientInterface_AddResponseCallback_Call) RunAndReturn(run func(model.MsgCounterType, func(api.ResponseMessage)) error) *FeatureClientInterface_AddResponseCallback_Call { _c.Call.Return(run) return _c } -// AddResultCallback provides a mock function for the type FeatureClientInterface -func (_mock *FeatureClientInterface) AddResultCallback(function func(msg api.ResponseMessage)) { - _mock.Called(function) - return +// AddResultCallback provides a mock function with given fields: function +func (_m *FeatureClientInterface) AddResultCallback(function func(api.ResponseMessage)) { + _m.Called(function) } // FeatureClientInterface_AddResultCallback_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddResultCallback' @@ -106,20 +81,14 @@ type FeatureClientInterface_AddResultCallback_Call struct { } // AddResultCallback is a helper method to define mock.On call -// - function func(msg api.ResponseMessage) +// - function func(api.ResponseMessage) func (_e *FeatureClientInterface_Expecter) AddResultCallback(function interface{}) *FeatureClientInterface_AddResultCallback_Call { return &FeatureClientInterface_AddResultCallback_Call{Call: _e.mock.On("AddResultCallback", function)} } -func (_c *FeatureClientInterface_AddResultCallback_Call) Run(run func(function func(msg api.ResponseMessage))) *FeatureClientInterface_AddResultCallback_Call { +func (_c *FeatureClientInterface_AddResultCallback_Call) Run(run func(function func(api.ResponseMessage))) *FeatureClientInterface_AddResultCallback_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 func(msg api.ResponseMessage) - if args[0] != nil { - arg0 = args[0].(func(msg api.ResponseMessage)) - } - run( - arg0, - ) + run(args[0].(func(api.ResponseMessage))) }) return _c } @@ -129,14 +98,14 @@ func (_c *FeatureClientInterface_AddResultCallback_Call) Return() *FeatureClient return _c } -func (_c *FeatureClientInterface_AddResultCallback_Call) RunAndReturn(run func(function func(msg api.ResponseMessage))) *FeatureClientInterface_AddResultCallback_Call { +func (_c *FeatureClientInterface_AddResultCallback_Call) RunAndReturn(run func(func(api.ResponseMessage))) *FeatureClientInterface_AddResultCallback_Call { _c.Run(run) return _c } -// Bind provides a mock function for the type FeatureClientInterface -func (_mock *FeatureClientInterface) Bind() (*model.MsgCounterType, error) { - ret := _mock.Called() +// Bind provides a mock function with no fields +func (_m *FeatureClientInterface) Bind() (*model.MsgCounterType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for Bind") @@ -144,21 +113,23 @@ func (_mock *FeatureClientInterface) Bind() (*model.MsgCounterType, error) { var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -179,8 +150,8 @@ func (_c *FeatureClientInterface_Bind_Call) Run(run func()) *FeatureClientInterf return _c } -func (_c *FeatureClientInterface_Bind_Call) Return(msgCounterType *model.MsgCounterType, err error) *FeatureClientInterface_Bind_Call { - _c.Call.Return(msgCounterType, err) +func (_c *FeatureClientInterface_Bind_Call) Return(_a0 *model.MsgCounterType, _a1 error) *FeatureClientInterface_Bind_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -189,20 +160,21 @@ func (_c *FeatureClientInterface_Bind_Call) RunAndReturn(run func() (*model.MsgC return _c } -// HasBinding provides a mock function for the type FeatureClientInterface -func (_mock *FeatureClientInterface) HasBinding() bool { - ret := _mock.Called() +// HasBinding provides a mock function with no fields +func (_m *FeatureClientInterface) HasBinding() bool { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for HasBinding") } var r0 bool - if returnFunc, ok := ret.Get(0).(func() bool); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -223,8 +195,8 @@ func (_c *FeatureClientInterface_HasBinding_Call) Run(run func()) *FeatureClient return _c } -func (_c *FeatureClientInterface_HasBinding_Call) Return(b bool) *FeatureClientInterface_HasBinding_Call { - _c.Call.Return(b) +func (_c *FeatureClientInterface_HasBinding_Call) Return(_a0 bool) *FeatureClientInterface_HasBinding_Call { + _c.Call.Return(_a0) return _c } @@ -233,20 +205,21 @@ func (_c *FeatureClientInterface_HasBinding_Call) RunAndReturn(run func() bool) return _c } -// HasSubscription provides a mock function for the type FeatureClientInterface -func (_mock *FeatureClientInterface) HasSubscription() bool { - ret := _mock.Called() +// HasSubscription provides a mock function with no fields +func (_m *FeatureClientInterface) HasSubscription() bool { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for HasSubscription") } var r0 bool - if returnFunc, ok := ret.Get(0).(func() bool); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -267,8 +240,8 @@ func (_c *FeatureClientInterface_HasSubscription_Call) Run(run func()) *FeatureC return _c } -func (_c *FeatureClientInterface_HasSubscription_Call) Return(b bool) *FeatureClientInterface_HasSubscription_Call { - _c.Call.Return(b) +func (_c *FeatureClientInterface_HasSubscription_Call) Return(_a0 bool) *FeatureClientInterface_HasSubscription_Call { + _c.Call.Return(_a0) return _c } @@ -277,9 +250,9 @@ func (_c *FeatureClientInterface_HasSubscription_Call) RunAndReturn(run func() b return _c } -// Subscribe provides a mock function for the type FeatureClientInterface -func (_mock *FeatureClientInterface) Subscribe() (*model.MsgCounterType, error) { - ret := _mock.Called() +// Subscribe provides a mock function with no fields +func (_m *FeatureClientInterface) Subscribe() (*model.MsgCounterType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for Subscribe") @@ -287,21 +260,23 @@ func (_mock *FeatureClientInterface) Subscribe() (*model.MsgCounterType, error) var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -322,8 +297,8 @@ func (_c *FeatureClientInterface_Subscribe_Call) Run(run func()) *FeatureClientI return _c } -func (_c *FeatureClientInterface_Subscribe_Call) Return(msgCounterType *model.MsgCounterType, err error) *FeatureClientInterface_Subscribe_Call { - _c.Call.Return(msgCounterType, err) +func (_c *FeatureClientInterface_Subscribe_Call) Return(_a0 *model.MsgCounterType, _a1 error) *FeatureClientInterface_Subscribe_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -331,3 +306,17 @@ func (_c *FeatureClientInterface_Subscribe_Call) RunAndReturn(run func() (*model _c.Call.Return(run) return _c } + +// NewFeatureClientInterface creates a new instance of FeatureClientInterface. 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 NewFeatureClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *FeatureClientInterface { + mock := &FeatureClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/FeatureServerInterface.go b/mocks/FeatureServerInterface.go index 2698e67d..fe726d65 100644 --- a/mocks/FeatureServerInterface.go +++ b/mocks/FeatureServerInterface.go @@ -1,12 +1,21 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks -import ( - mock "github.com/stretchr/testify/mock" -) +import mock "github.com/stretchr/testify/mock" + +// FeatureServerInterface is an autogenerated mock type for the FeatureServerInterface type +type FeatureServerInterface struct { + mock.Mock +} + +type FeatureServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *FeatureServerInterface) EXPECT() *FeatureServerInterface_Expecter { + return &FeatureServerInterface_Expecter{mock: &_m.Mock} +} // NewFeatureServerInterface creates a new instance of FeatureServerInterface. 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. @@ -21,16 +30,3 @@ func NewFeatureServerInterface(t interface { return mock } - -// FeatureServerInterface is an autogenerated mock type for the FeatureServerInterface type -type FeatureServerInterface struct { - mock.Mock -} - -type FeatureServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *FeatureServerInterface) EXPECT() *FeatureServerInterface_Expecter { - return &FeatureServerInterface_Expecter{mock: &_m.Mock} -} diff --git a/mocks/IdentificationClientInterface.go b/mocks/IdentificationClientInterface.go index 03182d03..e63f3fc9 100644 --- a/mocks/IdentificationClientInterface.go +++ b/mocks/IdentificationClientInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewIdentificationClientInterface creates a new instance of IdentificationClientInterface. 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 NewIdentificationClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *IdentificationClientInterface { - mock := &IdentificationClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // IdentificationClientInterface is an autogenerated mock type for the IdentificationClientInterface type type IdentificationClientInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *IdentificationClientInterface) EXPECT() *IdentificationClientInterface return &IdentificationClientInterface_Expecter{mock: &_m.Mock} } -// RequestValues provides a mock function for the type IdentificationClientInterface -func (_mock *IdentificationClientInterface) RequestValues() (*model.MsgCounterType, error) { - ret := _mock.Called() +// RequestValues provides a mock function with no fields +func (_m *IdentificationClientInterface) RequestValues() (*model.MsgCounterType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RequestValues") @@ -46,21 +30,23 @@ func (_mock *IdentificationClientInterface) RequestValues() (*model.MsgCounterTy var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -81,8 +67,8 @@ func (_c *IdentificationClientInterface_RequestValues_Call) Run(run func()) *Ide return _c } -func (_c *IdentificationClientInterface_RequestValues_Call) Return(msgCounterType *model.MsgCounterType, err error) *IdentificationClientInterface_RequestValues_Call { - _c.Call.Return(msgCounterType, err) +func (_c *IdentificationClientInterface_RequestValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IdentificationClientInterface_RequestValues_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -90,3 +76,17 @@ func (_c *IdentificationClientInterface_RequestValues_Call) RunAndReturn(run fun _c.Call.Return(run) return _c } + +// NewIdentificationClientInterface creates a new instance of IdentificationClientInterface. 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 NewIdentificationClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *IdentificationClientInterface { + mock := &IdentificationClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/IdentificationCommonInterface.go b/mocks/IdentificationCommonInterface.go index b2299ff6..7332ca28 100644 --- a/mocks/IdentificationCommonInterface.go +++ b/mocks/IdentificationCommonInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewIdentificationCommonInterface creates a new instance of IdentificationCommonInterface. 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 NewIdentificationCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *IdentificationCommonInterface { - mock := &IdentificationCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // IdentificationCommonInterface is an autogenerated mock type for the IdentificationCommonInterface type type IdentificationCommonInterface struct { mock.Mock @@ -36,20 +20,21 @@ func (_m *IdentificationCommonInterface) EXPECT() *IdentificationCommonInterface return &IdentificationCommonInterface_Expecter{mock: &_m.Mock} } -// CheckEventPayloadDataForFilter provides a mock function for the type IdentificationCommonInterface -func (_mock *IdentificationCommonInterface) CheckEventPayloadDataForFilter(payloadData any) bool { - ret := _mock.Called(payloadData) +// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData +func (_m *IdentificationCommonInterface) CheckEventPayloadDataForFilter(payloadData interface{}) bool { + ret := _m.Called(payloadData) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(any) bool); ok { - r0 = returnFunc(payloadData) + if rf, ok := ret.Get(0).(func(interface{}) bool); ok { + r0 = rf(payloadData) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -59,37 +44,31 @@ type IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call struct { } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData any +// - payloadData interface{} func (_e *IdentificationCommonInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { return &IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData)} } -func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any)) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{})) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 any - if args[0] != nil { - arg0 = args[0].(any) - } - run( - arg0, - ) + run(args[0].(interface{})) }) return _c } -func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(b) +func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(_a0) return _c } -func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any) bool) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}) bool) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetDataForFilter provides a mock function for the type IdentificationCommonInterface -func (_mock *IdentificationCommonInterface) GetDataForFilter(filter model.IdentificationDataType) ([]model.IdentificationDataType, error) { - ret := _mock.Called(filter) +// GetDataForFilter provides a mock function with given fields: filter +func (_m *IdentificationCommonInterface) GetDataForFilter(filter model.IdentificationDataType) ([]model.IdentificationDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDataForFilter") @@ -97,21 +76,23 @@ func (_mock *IdentificationCommonInterface) GetDataForFilter(filter model.Identi var r0 []model.IdentificationDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.IdentificationDataType) ([]model.IdentificationDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.IdentificationDataType) ([]model.IdentificationDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.IdentificationDataType) []model.IdentificationDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.IdentificationDataType) []model.IdentificationDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.IdentificationDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.IdentificationDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.IdentificationDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -128,23 +109,31 @@ func (_e *IdentificationCommonInterface_Expecter) GetDataForFilter(filter interf func (_c *IdentificationCommonInterface_GetDataForFilter_Call) Run(run func(filter model.IdentificationDataType)) *IdentificationCommonInterface_GetDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.IdentificationDataType - if args[0] != nil { - arg0 = args[0].(model.IdentificationDataType) - } - run( - arg0, - ) + run(args[0].(model.IdentificationDataType)) }) return _c } -func (_c *IdentificationCommonInterface_GetDataForFilter_Call) Return(identificationDataTypes []model.IdentificationDataType, err error) *IdentificationCommonInterface_GetDataForFilter_Call { - _c.Call.Return(identificationDataTypes, err) +func (_c *IdentificationCommonInterface_GetDataForFilter_Call) Return(_a0 []model.IdentificationDataType, _a1 error) *IdentificationCommonInterface_GetDataForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *IdentificationCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(filter model.IdentificationDataType) ([]model.IdentificationDataType, error)) *IdentificationCommonInterface_GetDataForFilter_Call { +func (_c *IdentificationCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(model.IdentificationDataType) ([]model.IdentificationDataType, error)) *IdentificationCommonInterface_GetDataForFilter_Call { _c.Call.Return(run) return _c } + +// NewIdentificationCommonInterface creates a new instance of IdentificationCommonInterface. 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 NewIdentificationCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *IdentificationCommonInterface { + mock := &IdentificationCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/IdentificationServerInterface.go b/mocks/IdentificationServerInterface.go index fabac804..a7e06bfc 100644 --- a/mocks/IdentificationServerInterface.go +++ b/mocks/IdentificationServerInterface.go @@ -1,12 +1,21 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks -import ( - mock "github.com/stretchr/testify/mock" -) +import mock "github.com/stretchr/testify/mock" + +// IdentificationServerInterface is an autogenerated mock type for the IdentificationServerInterface type +type IdentificationServerInterface struct { + mock.Mock +} + +type IdentificationServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *IdentificationServerInterface) EXPECT() *IdentificationServerInterface_Expecter { + return &IdentificationServerInterface_Expecter{mock: &_m.Mock} +} // NewIdentificationServerInterface creates a new instance of IdentificationServerInterface. 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. @@ -21,16 +30,3 @@ func NewIdentificationServerInterface(t interface { return mock } - -// IdentificationServerInterface is an autogenerated mock type for the IdentificationServerInterface type -type IdentificationServerInterface struct { - mock.Mock -} - -type IdentificationServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *IdentificationServerInterface) EXPECT() *IdentificationServerInterface_Expecter { - return &IdentificationServerInterface_Expecter{mock: &_m.Mock} -} diff --git a/mocks/IncentiveTableClientInterface.go b/mocks/IncentiveTableClientInterface.go index 8229e884..0c5428a9 100644 --- a/mocks/IncentiveTableClientInterface.go +++ b/mocks/IncentiveTableClientInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewIncentiveTableClientInterface creates a new instance of IncentiveTableClientInterface. 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 NewIncentiveTableClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *IncentiveTableClientInterface { - mock := &IncentiveTableClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // IncentiveTableClientInterface is an autogenerated mock type for the IncentiveTableClientInterface type type IncentiveTableClientInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *IncentiveTableClientInterface) EXPECT() *IncentiveTableClientInterface return &IncentiveTableClientInterface_Expecter{mock: &_m.Mock} } -// RequestConstraints provides a mock function for the type IncentiveTableClientInterface -func (_mock *IncentiveTableClientInterface) RequestConstraints() (*model.MsgCounterType, error) { - ret := _mock.Called() +// RequestConstraints provides a mock function with no fields +func (_m *IncentiveTableClientInterface) RequestConstraints() (*model.MsgCounterType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RequestConstraints") @@ -46,21 +30,23 @@ func (_mock *IncentiveTableClientInterface) RequestConstraints() (*model.MsgCoun var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -81,8 +67,8 @@ func (_c *IncentiveTableClientInterface_RequestConstraints_Call) Run(run func()) return _c } -func (_c *IncentiveTableClientInterface_RequestConstraints_Call) Return(msgCounterType *model.MsgCounterType, err error) *IncentiveTableClientInterface_RequestConstraints_Call { - _c.Call.Return(msgCounterType, err) +func (_c *IncentiveTableClientInterface_RequestConstraints_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_RequestConstraints_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -91,9 +77,9 @@ func (_c *IncentiveTableClientInterface_RequestConstraints_Call) RunAndReturn(ru return _c } -// RequestDescriptions provides a mock function for the type IncentiveTableClientInterface -func (_mock *IncentiveTableClientInterface) RequestDescriptions() (*model.MsgCounterType, error) { - ret := _mock.Called() +// RequestDescriptions provides a mock function with no fields +func (_m *IncentiveTableClientInterface) RequestDescriptions() (*model.MsgCounterType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RequestDescriptions") @@ -101,21 +87,23 @@ func (_mock *IncentiveTableClientInterface) RequestDescriptions() (*model.MsgCou var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -136,8 +124,8 @@ func (_c *IncentiveTableClientInterface_RequestDescriptions_Call) Run(run func() return _c } -func (_c *IncentiveTableClientInterface_RequestDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *IncentiveTableClientInterface_RequestDescriptions_Call { - _c.Call.Return(msgCounterType, err) +func (_c *IncentiveTableClientInterface_RequestDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_RequestDescriptions_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -146,9 +134,9 @@ func (_c *IncentiveTableClientInterface_RequestDescriptions_Call) RunAndReturn(r return _c } -// RequestValues provides a mock function for the type IncentiveTableClientInterface -func (_mock *IncentiveTableClientInterface) RequestValues() (*model.MsgCounterType, error) { - ret := _mock.Called() +// RequestValues provides a mock function with no fields +func (_m *IncentiveTableClientInterface) RequestValues() (*model.MsgCounterType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RequestValues") @@ -156,21 +144,23 @@ func (_mock *IncentiveTableClientInterface) RequestValues() (*model.MsgCounterTy var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -191,8 +181,8 @@ func (_c *IncentiveTableClientInterface_RequestValues_Call) Run(run func()) *Inc return _c } -func (_c *IncentiveTableClientInterface_RequestValues_Call) Return(msgCounterType *model.MsgCounterType, err error) *IncentiveTableClientInterface_RequestValues_Call { - _c.Call.Return(msgCounterType, err) +func (_c *IncentiveTableClientInterface_RequestValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_RequestValues_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -201,9 +191,9 @@ func (_c *IncentiveTableClientInterface_RequestValues_Call) RunAndReturn(run fun return _c } -// WriteDescriptions provides a mock function for the type IncentiveTableClientInterface -func (_mock *IncentiveTableClientInterface) WriteDescriptions(data []model.IncentiveTableDescriptionType) (*model.MsgCounterType, error) { - ret := _mock.Called(data) +// WriteDescriptions provides a mock function with given fields: data +func (_m *IncentiveTableClientInterface) WriteDescriptions(data []model.IncentiveTableDescriptionType) (*model.MsgCounterType, error) { + ret := _m.Called(data) if len(ret) == 0 { panic("no return value specified for WriteDescriptions") @@ -211,21 +201,23 @@ func (_mock *IncentiveTableClientInterface) WriteDescriptions(data []model.Incen var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func([]model.IncentiveTableDescriptionType) (*model.MsgCounterType, error)); ok { - return returnFunc(data) + if rf, ok := ret.Get(0).(func([]model.IncentiveTableDescriptionType) (*model.MsgCounterType, error)); ok { + return rf(data) } - if returnFunc, ok := ret.Get(0).(func([]model.IncentiveTableDescriptionType) *model.MsgCounterType); ok { - r0 = returnFunc(data) + if rf, ok := ret.Get(0).(func([]model.IncentiveTableDescriptionType) *model.MsgCounterType); ok { + r0 = rf(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func([]model.IncentiveTableDescriptionType) error); ok { - r1 = returnFunc(data) + + if rf, ok := ret.Get(1).(func([]model.IncentiveTableDescriptionType) error); ok { + r1 = rf(data) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -242,30 +234,24 @@ func (_e *IncentiveTableClientInterface_Expecter) WriteDescriptions(data interfa func (_c *IncentiveTableClientInterface_WriteDescriptions_Call) Run(run func(data []model.IncentiveTableDescriptionType)) *IncentiveTableClientInterface_WriteDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []model.IncentiveTableDescriptionType - if args[0] != nil { - arg0 = args[0].([]model.IncentiveTableDescriptionType) - } - run( - arg0, - ) + run(args[0].([]model.IncentiveTableDescriptionType)) }) return _c } -func (_c *IncentiveTableClientInterface_WriteDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *IncentiveTableClientInterface_WriteDescriptions_Call { - _c.Call.Return(msgCounterType, err) +func (_c *IncentiveTableClientInterface_WriteDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_WriteDescriptions_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *IncentiveTableClientInterface_WriteDescriptions_Call) RunAndReturn(run func(data []model.IncentiveTableDescriptionType) (*model.MsgCounterType, error)) *IncentiveTableClientInterface_WriteDescriptions_Call { +func (_c *IncentiveTableClientInterface_WriteDescriptions_Call) RunAndReturn(run func([]model.IncentiveTableDescriptionType) (*model.MsgCounterType, error)) *IncentiveTableClientInterface_WriteDescriptions_Call { _c.Call.Return(run) return _c } -// WriteValues provides a mock function for the type IncentiveTableClientInterface -func (_mock *IncentiveTableClientInterface) WriteValues(data []model.IncentiveTableType) (*model.MsgCounterType, error) { - ret := _mock.Called(data) +// WriteValues provides a mock function with given fields: data +func (_m *IncentiveTableClientInterface) WriteValues(data []model.IncentiveTableType) (*model.MsgCounterType, error) { + ret := _m.Called(data) if len(ret) == 0 { panic("no return value specified for WriteValues") @@ -273,21 +259,23 @@ func (_mock *IncentiveTableClientInterface) WriteValues(data []model.IncentiveTa var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func([]model.IncentiveTableType) (*model.MsgCounterType, error)); ok { - return returnFunc(data) + if rf, ok := ret.Get(0).(func([]model.IncentiveTableType) (*model.MsgCounterType, error)); ok { + return rf(data) } - if returnFunc, ok := ret.Get(0).(func([]model.IncentiveTableType) *model.MsgCounterType); ok { - r0 = returnFunc(data) + if rf, ok := ret.Get(0).(func([]model.IncentiveTableType) *model.MsgCounterType); ok { + r0 = rf(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func([]model.IncentiveTableType) error); ok { - r1 = returnFunc(data) + + if rf, ok := ret.Get(1).(func([]model.IncentiveTableType) error); ok { + r1 = rf(data) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -304,23 +292,31 @@ func (_e *IncentiveTableClientInterface_Expecter) WriteValues(data interface{}) func (_c *IncentiveTableClientInterface_WriteValues_Call) Run(run func(data []model.IncentiveTableType)) *IncentiveTableClientInterface_WriteValues_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []model.IncentiveTableType - if args[0] != nil { - arg0 = args[0].([]model.IncentiveTableType) - } - run( - arg0, - ) + run(args[0].([]model.IncentiveTableType)) }) return _c } -func (_c *IncentiveTableClientInterface_WriteValues_Call) Return(msgCounterType *model.MsgCounterType, err error) *IncentiveTableClientInterface_WriteValues_Call { - _c.Call.Return(msgCounterType, err) +func (_c *IncentiveTableClientInterface_WriteValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_WriteValues_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *IncentiveTableClientInterface_WriteValues_Call) RunAndReturn(run func(data []model.IncentiveTableType) (*model.MsgCounterType, error)) *IncentiveTableClientInterface_WriteValues_Call { +func (_c *IncentiveTableClientInterface_WriteValues_Call) RunAndReturn(run func([]model.IncentiveTableType) (*model.MsgCounterType, error)) *IncentiveTableClientInterface_WriteValues_Call { _c.Call.Return(run) return _c } + +// NewIncentiveTableClientInterface creates a new instance of IncentiveTableClientInterface. 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 NewIncentiveTableClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *IncentiveTableClientInterface { + mock := &IncentiveTableClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/IncentiveTableCommonInterface.go b/mocks/IncentiveTableCommonInterface.go index b465d1b1..f4536ef3 100644 --- a/mocks/IncentiveTableCommonInterface.go +++ b/mocks/IncentiveTableCommonInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewIncentiveTableCommonInterface creates a new instance of IncentiveTableCommonInterface. 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 NewIncentiveTableCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *IncentiveTableCommonInterface { - mock := &IncentiveTableCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // IncentiveTableCommonInterface is an autogenerated mock type for the IncentiveTableCommonInterface type type IncentiveTableCommonInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *IncentiveTableCommonInterface) EXPECT() *IncentiveTableCommonInterface return &IncentiveTableCommonInterface_Expecter{mock: &_m.Mock} } -// GetConstraints provides a mock function for the type IncentiveTableCommonInterface -func (_mock *IncentiveTableCommonInterface) GetConstraints() ([]model.IncentiveTableConstraintsType, error) { - ret := _mock.Called() +// GetConstraints provides a mock function with no fields +func (_m *IncentiveTableCommonInterface) GetConstraints() ([]model.IncentiveTableConstraintsType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for GetConstraints") @@ -46,21 +30,23 @@ func (_mock *IncentiveTableCommonInterface) GetConstraints() ([]model.IncentiveT var r0 []model.IncentiveTableConstraintsType var r1 error - if returnFunc, ok := ret.Get(0).(func() ([]model.IncentiveTableConstraintsType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() ([]model.IncentiveTableConstraintsType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() []model.IncentiveTableConstraintsType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() []model.IncentiveTableConstraintsType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.IncentiveTableConstraintsType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -81,8 +67,8 @@ func (_c *IncentiveTableCommonInterface_GetConstraints_Call) Run(run func()) *In return _c } -func (_c *IncentiveTableCommonInterface_GetConstraints_Call) Return(incentiveTableConstraintsTypes []model.IncentiveTableConstraintsType, err error) *IncentiveTableCommonInterface_GetConstraints_Call { - _c.Call.Return(incentiveTableConstraintsTypes, err) +func (_c *IncentiveTableCommonInterface_GetConstraints_Call) Return(_a0 []model.IncentiveTableConstraintsType, _a1 error) *IncentiveTableCommonInterface_GetConstraints_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -91,9 +77,9 @@ func (_c *IncentiveTableCommonInterface_GetConstraints_Call) RunAndReturn(run fu return _c } -// GetData provides a mock function for the type IncentiveTableCommonInterface -func (_mock *IncentiveTableCommonInterface) GetData() ([]model.IncentiveTableType, error) { - ret := _mock.Called() +// GetData provides a mock function with no fields +func (_m *IncentiveTableCommonInterface) GetData() ([]model.IncentiveTableType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for GetData") @@ -101,21 +87,23 @@ func (_mock *IncentiveTableCommonInterface) GetData() ([]model.IncentiveTableTyp var r0 []model.IncentiveTableType var r1 error - if returnFunc, ok := ret.Get(0).(func() ([]model.IncentiveTableType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() ([]model.IncentiveTableType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() []model.IncentiveTableType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() []model.IncentiveTableType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.IncentiveTableType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -136,8 +124,8 @@ func (_c *IncentiveTableCommonInterface_GetData_Call) Run(run func()) *Incentive return _c } -func (_c *IncentiveTableCommonInterface_GetData_Call) Return(incentiveTableTypes []model.IncentiveTableType, err error) *IncentiveTableCommonInterface_GetData_Call { - _c.Call.Return(incentiveTableTypes, err) +func (_c *IncentiveTableCommonInterface_GetData_Call) Return(_a0 []model.IncentiveTableType, _a1 error) *IncentiveTableCommonInterface_GetData_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -146,9 +134,9 @@ func (_c *IncentiveTableCommonInterface_GetData_Call) RunAndReturn(run func() ([ return _c } -// GetDescriptionsForFilter provides a mock function for the type IncentiveTableCommonInterface -func (_mock *IncentiveTableCommonInterface) GetDescriptionsForFilter(filter model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error) { - ret := _mock.Called(filter) +// GetDescriptionsForFilter provides a mock function with given fields: filter +func (_m *IncentiveTableCommonInterface) GetDescriptionsForFilter(filter model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionsForFilter") @@ -156,21 +144,23 @@ func (_mock *IncentiveTableCommonInterface) GetDescriptionsForFilter(filter mode var r0 []model.IncentiveTableDescriptionType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.TariffDescriptionDataType) []model.IncentiveTableDescriptionType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.TariffDescriptionDataType) []model.IncentiveTableDescriptionType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.IncentiveTableDescriptionType) } } - if returnFunc, ok := ret.Get(1).(func(model.TariffDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.TariffDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -187,23 +177,31 @@ func (_e *IncentiveTableCommonInterface_Expecter) GetDescriptionsForFilter(filte func (_c *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call) Run(run func(filter model.TariffDescriptionDataType)) *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.TariffDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.TariffDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.TariffDescriptionDataType)) }) return _c } -func (_c *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call) Return(incentiveTableDescriptionTypes []model.IncentiveTableDescriptionType, err error) *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call { - _c.Call.Return(incentiveTableDescriptionTypes, err) +func (_c *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call) Return(_a0 []model.IncentiveTableDescriptionType, _a1 error) *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(filter model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)) *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call { +func (_c *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)) *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Return(run) return _c } + +// NewIncentiveTableCommonInterface creates a new instance of IncentiveTableCommonInterface. 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 NewIncentiveTableCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *IncentiveTableCommonInterface { + mock := &IncentiveTableCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/IncentiveTableServerInterface.go b/mocks/IncentiveTableServerInterface.go index 8d9eaaab..b4b61ec4 100644 --- a/mocks/IncentiveTableServerInterface.go +++ b/mocks/IncentiveTableServerInterface.go @@ -1,12 +1,21 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks -import ( - mock "github.com/stretchr/testify/mock" -) +import mock "github.com/stretchr/testify/mock" + +// IncentiveTableServerInterface is an autogenerated mock type for the IncentiveTableServerInterface type +type IncentiveTableServerInterface struct { + mock.Mock +} + +type IncentiveTableServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *IncentiveTableServerInterface) EXPECT() *IncentiveTableServerInterface_Expecter { + return &IncentiveTableServerInterface_Expecter{mock: &_m.Mock} +} // NewIncentiveTableServerInterface creates a new instance of IncentiveTableServerInterface. 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. @@ -21,16 +30,3 @@ func NewIncentiveTableServerInterface(t interface { return mock } - -// IncentiveTableServerInterface is an autogenerated mock type for the IncentiveTableServerInterface type -type IncentiveTableServerInterface struct { - mock.Mock -} - -type IncentiveTableServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *IncentiveTableServerInterface) EXPECT() *IncentiveTableServerInterface_Expecter { - return &IncentiveTableServerInterface_Expecter{mock: &_m.Mock} -} diff --git a/mocks/LoadControlClientInterface.go b/mocks/LoadControlClientInterface.go index 79d2bf60..cbd5ab7f 100644 --- a/mocks/LoadControlClientInterface.go +++ b/mocks/LoadControlClientInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewLoadControlClientInterface creates a new instance of LoadControlClientInterface. 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 NewLoadControlClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *LoadControlClientInterface { - mock := &LoadControlClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // LoadControlClientInterface is an autogenerated mock type for the LoadControlClientInterface type type LoadControlClientInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *LoadControlClientInterface) EXPECT() *LoadControlClientInterface_Expec return &LoadControlClientInterface_Expecter{mock: &_m.Mock} } -// RequestLimitConstraints provides a mock function for the type LoadControlClientInterface -func (_mock *LoadControlClientInterface) RequestLimitConstraints(selector *model.LoadControlLimitConstraintsListDataSelectorsType, elements *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestLimitConstraints provides a mock function with given fields: selector, elements +func (_m *LoadControlClientInterface) RequestLimitConstraints(selector *model.LoadControlLimitConstraintsListDataSelectorsType, elements *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestLimitConstraints") @@ -46,21 +30,23 @@ func (_mock *LoadControlClientInterface) RequestLimitConstraints(selector *model var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -78,35 +64,24 @@ func (_e *LoadControlClientInterface_Expecter) RequestLimitConstraints(selector func (_c *LoadControlClientInterface_RequestLimitConstraints_Call) Run(run func(selector *model.LoadControlLimitConstraintsListDataSelectorsType, elements *model.LoadControlLimitConstraintsDataElementsType)) *LoadControlClientInterface_RequestLimitConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.LoadControlLimitConstraintsListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.LoadControlLimitConstraintsListDataSelectorsType) - } - var arg1 *model.LoadControlLimitConstraintsDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.LoadControlLimitConstraintsDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.LoadControlLimitConstraintsListDataSelectorsType), args[1].(*model.LoadControlLimitConstraintsDataElementsType)) }) return _c } -func (_c *LoadControlClientInterface_RequestLimitConstraints_Call) Return(msgCounterType *model.MsgCounterType, err error) *LoadControlClientInterface_RequestLimitConstraints_Call { - _c.Call.Return(msgCounterType, err) +func (_c *LoadControlClientInterface_RequestLimitConstraints_Call) Return(_a0 *model.MsgCounterType, _a1 error) *LoadControlClientInterface_RequestLimitConstraints_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *LoadControlClientInterface_RequestLimitConstraints_Call) RunAndReturn(run func(selector *model.LoadControlLimitConstraintsListDataSelectorsType, elements *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitConstraints_Call { +func (_c *LoadControlClientInterface_RequestLimitConstraints_Call) RunAndReturn(run func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitConstraints_Call { _c.Call.Return(run) return _c } -// RequestLimitData provides a mock function for the type LoadControlClientInterface -func (_mock *LoadControlClientInterface) RequestLimitData(selector *model.LoadControlLimitListDataSelectorsType, elements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestLimitData provides a mock function with given fields: selector, elements +func (_m *LoadControlClientInterface) RequestLimitData(selector *model.LoadControlLimitListDataSelectorsType, elements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestLimitData") @@ -114,21 +89,23 @@ func (_mock *LoadControlClientInterface) RequestLimitData(selector *model.LoadCo var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -146,35 +123,24 @@ func (_e *LoadControlClientInterface_Expecter) RequestLimitData(selector interfa func (_c *LoadControlClientInterface_RequestLimitData_Call) Run(run func(selector *model.LoadControlLimitListDataSelectorsType, elements *model.LoadControlLimitDataElementsType)) *LoadControlClientInterface_RequestLimitData_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.LoadControlLimitListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.LoadControlLimitListDataSelectorsType) - } - var arg1 *model.LoadControlLimitDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.LoadControlLimitDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.LoadControlLimitListDataSelectorsType), args[1].(*model.LoadControlLimitDataElementsType)) }) return _c } -func (_c *LoadControlClientInterface_RequestLimitData_Call) Return(msgCounterType *model.MsgCounterType, err error) *LoadControlClientInterface_RequestLimitData_Call { - _c.Call.Return(msgCounterType, err) +func (_c *LoadControlClientInterface_RequestLimitData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *LoadControlClientInterface_RequestLimitData_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *LoadControlClientInterface_RequestLimitData_Call) RunAndReturn(run func(selector *model.LoadControlLimitListDataSelectorsType, elements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitData_Call { +func (_c *LoadControlClientInterface_RequestLimitData_Call) RunAndReturn(run func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitData_Call { _c.Call.Return(run) return _c } -// RequestLimitDescriptions provides a mock function for the type LoadControlClientInterface -func (_mock *LoadControlClientInterface) RequestLimitDescriptions(selector *model.LoadControlLimitDescriptionListDataSelectorsType, elements *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestLimitDescriptions provides a mock function with given fields: selector, elements +func (_m *LoadControlClientInterface) RequestLimitDescriptions(selector *model.LoadControlLimitDescriptionListDataSelectorsType, elements *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestLimitDescriptions") @@ -182,21 +148,23 @@ func (_mock *LoadControlClientInterface) RequestLimitDescriptions(selector *mode var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -214,35 +182,24 @@ func (_e *LoadControlClientInterface_Expecter) RequestLimitDescriptions(selector func (_c *LoadControlClientInterface_RequestLimitDescriptions_Call) Run(run func(selector *model.LoadControlLimitDescriptionListDataSelectorsType, elements *model.LoadControlLimitDescriptionDataElementsType)) *LoadControlClientInterface_RequestLimitDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.LoadControlLimitDescriptionListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.LoadControlLimitDescriptionListDataSelectorsType) - } - var arg1 *model.LoadControlLimitDescriptionDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.LoadControlLimitDescriptionDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.LoadControlLimitDescriptionListDataSelectorsType), args[1].(*model.LoadControlLimitDescriptionDataElementsType)) }) return _c } -func (_c *LoadControlClientInterface_RequestLimitDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *LoadControlClientInterface_RequestLimitDescriptions_Call { - _c.Call.Return(msgCounterType, err) +func (_c *LoadControlClientInterface_RequestLimitDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *LoadControlClientInterface_RequestLimitDescriptions_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *LoadControlClientInterface_RequestLimitDescriptions_Call) RunAndReturn(run func(selector *model.LoadControlLimitDescriptionListDataSelectorsType, elements *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitDescriptions_Call { +func (_c *LoadControlClientInterface_RequestLimitDescriptions_Call) RunAndReturn(run func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitDescriptions_Call { _c.Call.Return(run) return _c } -// WriteLimitData provides a mock function for the type LoadControlClientInterface -func (_mock *LoadControlClientInterface) WriteLimitData(data []model.LoadControlLimitDataType, deleteSelectors *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(data, deleteSelectors, deleteElements) +// WriteLimitData provides a mock function with given fields: data, deleteSelectors, deleteElements +func (_m *LoadControlClientInterface) WriteLimitData(data []model.LoadControlLimitDataType, deleteSelectors *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(data, deleteSelectors, deleteElements) if len(ret) == 0 { panic("no return value specified for WriteLimitData") @@ -250,21 +207,23 @@ func (_mock *LoadControlClientInterface) WriteLimitData(data []model.LoadControl var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(data, deleteSelectors, deleteElements) + if rf, ok := ret.Get(0).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(data, deleteSelectors, deleteElements) } - if returnFunc, ok := ret.Get(0).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(data, deleteSelectors, deleteElements) + if rf, ok := ret.Get(0).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) *model.MsgCounterType); ok { + r0 = rf(data, deleteSelectors, deleteElements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { - r1 = returnFunc(data, deleteSelectors, deleteElements) + + if rf, ok := ret.Get(1).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { + r1 = rf(data, deleteSelectors, deleteElements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -283,33 +242,31 @@ func (_e *LoadControlClientInterface_Expecter) WriteLimitData(data interface{}, func (_c *LoadControlClientInterface_WriteLimitData_Call) Run(run func(data []model.LoadControlLimitDataType, deleteSelectors *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType)) *LoadControlClientInterface_WriteLimitData_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []model.LoadControlLimitDataType - if args[0] != nil { - arg0 = args[0].([]model.LoadControlLimitDataType) - } - var arg1 *model.LoadControlLimitListDataSelectorsType - if args[1] != nil { - arg1 = args[1].(*model.LoadControlLimitListDataSelectorsType) - } - var arg2 *model.LoadControlLimitDataElementsType - if args[2] != nil { - arg2 = args[2].(*model.LoadControlLimitDataElementsType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].([]model.LoadControlLimitDataType), args[1].(*model.LoadControlLimitListDataSelectorsType), args[2].(*model.LoadControlLimitDataElementsType)) }) return _c } -func (_c *LoadControlClientInterface_WriteLimitData_Call) Return(msgCounterType *model.MsgCounterType, err error) *LoadControlClientInterface_WriteLimitData_Call { - _c.Call.Return(msgCounterType, err) +func (_c *LoadControlClientInterface_WriteLimitData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *LoadControlClientInterface_WriteLimitData_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *LoadControlClientInterface_WriteLimitData_Call) RunAndReturn(run func(data []model.LoadControlLimitDataType, deleteSelectors *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_WriteLimitData_Call { +func (_c *LoadControlClientInterface_WriteLimitData_Call) RunAndReturn(run func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_WriteLimitData_Call { _c.Call.Return(run) return _c } + +// NewLoadControlClientInterface creates a new instance of LoadControlClientInterface. 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 NewLoadControlClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *LoadControlClientInterface { + mock := &LoadControlClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/LoadControlCommonInterface.go b/mocks/LoadControlCommonInterface.go index 0c4ed62d..a6f29166 100644 --- a/mocks/LoadControlCommonInterface.go +++ b/mocks/LoadControlCommonInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewLoadControlCommonInterface creates a new instance of LoadControlCommonInterface. 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 NewLoadControlCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *LoadControlCommonInterface { - mock := &LoadControlCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // LoadControlCommonInterface is an autogenerated mock type for the LoadControlCommonInterface type type LoadControlCommonInterface struct { mock.Mock @@ -36,20 +20,21 @@ func (_m *LoadControlCommonInterface) EXPECT() *LoadControlCommonInterface_Expec return &LoadControlCommonInterface_Expecter{mock: &_m.Mock} } -// CheckEventPayloadDataForFilter provides a mock function for the type LoadControlCommonInterface -func (_mock *LoadControlCommonInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { - ret := _mock.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter +func (_m *LoadControlCommonInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { + ret := _m.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { - r0 = returnFunc(payloadData, filter) + if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { + r0 = rf(payloadData, filter) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -59,43 +44,32 @@ type LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call struct { } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData any -// - filter any +// - payloadData interface{} +// - filter interface{} func (_e *LoadControlCommonInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { return &LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 any - if args[0] != nil { - arg0 = args[0].(any) - } - var arg1 any - if args[1] != nil { - arg1 = args[1].(any) - } - run( - arg0, - arg1, - ) + run(args[0].(interface{}), args[1].(interface{})) }) return _c } -func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(b) +func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(_a0) return _c } -func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetLimitDataForFilter provides a mock function for the type LoadControlCommonInterface -func (_mock *LoadControlCommonInterface) GetLimitDataForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error) { - ret := _mock.Called(filter) +// GetLimitDataForFilter provides a mock function with given fields: filter +func (_m *LoadControlCommonInterface) GetLimitDataForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetLimitDataForFilter") @@ -103,21 +77,23 @@ func (_mock *LoadControlCommonInterface) GetLimitDataForFilter(filter model.Load var r0 []model.LoadControlLimitDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) []model.LoadControlLimitDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) []model.LoadControlLimitDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.LoadControlLimitDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.LoadControlLimitDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.LoadControlLimitDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -134,30 +110,24 @@ func (_e *LoadControlCommonInterface_Expecter) GetLimitDataForFilter(filter inte func (_c *LoadControlCommonInterface_GetLimitDataForFilter_Call) Run(run func(filter model.LoadControlLimitDescriptionDataType)) *LoadControlCommonInterface_GetLimitDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.LoadControlLimitDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.LoadControlLimitDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.LoadControlLimitDescriptionDataType)) }) return _c } -func (_c *LoadControlCommonInterface_GetLimitDataForFilter_Call) Return(loadControlLimitDataTypes []model.LoadControlLimitDataType, err error) *LoadControlCommonInterface_GetLimitDataForFilter_Call { - _c.Call.Return(loadControlLimitDataTypes, err) +func (_c *LoadControlCommonInterface_GetLimitDataForFilter_Call) Return(_a0 []model.LoadControlLimitDataType, _a1 error) *LoadControlCommonInterface_GetLimitDataForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *LoadControlCommonInterface_GetLimitDataForFilter_Call) RunAndReturn(run func(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)) *LoadControlCommonInterface_GetLimitDataForFilter_Call { +func (_c *LoadControlCommonInterface_GetLimitDataForFilter_Call) RunAndReturn(run func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)) *LoadControlCommonInterface_GetLimitDataForFilter_Call { _c.Call.Return(run) return _c } -// GetLimitDataForId provides a mock function for the type LoadControlCommonInterface -func (_mock *LoadControlCommonInterface) GetLimitDataForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error) { - ret := _mock.Called(limitId) +// GetLimitDataForId provides a mock function with given fields: limitId +func (_m *LoadControlCommonInterface) GetLimitDataForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error) { + ret := _m.Called(limitId) if len(ret) == 0 { panic("no return value specified for GetLimitDataForId") @@ -165,21 +135,23 @@ func (_mock *LoadControlCommonInterface) GetLimitDataForId(limitId model.LoadCon var r0 *model.LoadControlLimitDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)); ok { - return returnFunc(limitId) + if rf, ok := ret.Get(0).(func(model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)); ok { + return rf(limitId) } - if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitIdType) *model.LoadControlLimitDataType); ok { - r0 = returnFunc(limitId) + if rf, ok := ret.Get(0).(func(model.LoadControlLimitIdType) *model.LoadControlLimitDataType); ok { + r0 = rf(limitId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.LoadControlLimitDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.LoadControlLimitIdType) error); ok { - r1 = returnFunc(limitId) + + if rf, ok := ret.Get(1).(func(model.LoadControlLimitIdType) error); ok { + r1 = rf(limitId) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -196,30 +168,24 @@ func (_e *LoadControlCommonInterface_Expecter) GetLimitDataForId(limitId interfa func (_c *LoadControlCommonInterface_GetLimitDataForId_Call) Run(run func(limitId model.LoadControlLimitIdType)) *LoadControlCommonInterface_GetLimitDataForId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.LoadControlLimitIdType - if args[0] != nil { - arg0 = args[0].(model.LoadControlLimitIdType) - } - run( - arg0, - ) + run(args[0].(model.LoadControlLimitIdType)) }) return _c } -func (_c *LoadControlCommonInterface_GetLimitDataForId_Call) Return(loadControlLimitDataType *model.LoadControlLimitDataType, err error) *LoadControlCommonInterface_GetLimitDataForId_Call { - _c.Call.Return(loadControlLimitDataType, err) +func (_c *LoadControlCommonInterface_GetLimitDataForId_Call) Return(_a0 *model.LoadControlLimitDataType, _a1 error) *LoadControlCommonInterface_GetLimitDataForId_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *LoadControlCommonInterface_GetLimitDataForId_Call) RunAndReturn(run func(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)) *LoadControlCommonInterface_GetLimitDataForId_Call { +func (_c *LoadControlCommonInterface_GetLimitDataForId_Call) RunAndReturn(run func(model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)) *LoadControlCommonInterface_GetLimitDataForId_Call { _c.Call.Return(run) return _c } -// GetLimitDescriptionForId provides a mock function for the type LoadControlCommonInterface -func (_mock *LoadControlCommonInterface) GetLimitDescriptionForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error) { - ret := _mock.Called(limitId) +// GetLimitDescriptionForId provides a mock function with given fields: limitId +func (_m *LoadControlCommonInterface) GetLimitDescriptionForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error) { + ret := _m.Called(limitId) if len(ret) == 0 { panic("no return value specified for GetLimitDescriptionForId") @@ -227,21 +193,23 @@ func (_mock *LoadControlCommonInterface) GetLimitDescriptionForId(limitId model. var r0 *model.LoadControlLimitDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error)); ok { - return returnFunc(limitId) + if rf, ok := ret.Get(0).(func(model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error)); ok { + return rf(limitId) } - if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitIdType) *model.LoadControlLimitDescriptionDataType); ok { - r0 = returnFunc(limitId) + if rf, ok := ret.Get(0).(func(model.LoadControlLimitIdType) *model.LoadControlLimitDescriptionDataType); ok { + r0 = rf(limitId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.LoadControlLimitDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.LoadControlLimitIdType) error); ok { - r1 = returnFunc(limitId) + + if rf, ok := ret.Get(1).(func(model.LoadControlLimitIdType) error); ok { + r1 = rf(limitId) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -258,30 +226,24 @@ func (_e *LoadControlCommonInterface_Expecter) GetLimitDescriptionForId(limitId func (_c *LoadControlCommonInterface_GetLimitDescriptionForId_Call) Run(run func(limitId model.LoadControlLimitIdType)) *LoadControlCommonInterface_GetLimitDescriptionForId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.LoadControlLimitIdType - if args[0] != nil { - arg0 = args[0].(model.LoadControlLimitIdType) - } - run( - arg0, - ) + run(args[0].(model.LoadControlLimitIdType)) }) return _c } -func (_c *LoadControlCommonInterface_GetLimitDescriptionForId_Call) Return(loadControlLimitDescriptionDataType *model.LoadControlLimitDescriptionDataType, err error) *LoadControlCommonInterface_GetLimitDescriptionForId_Call { - _c.Call.Return(loadControlLimitDescriptionDataType, err) +func (_c *LoadControlCommonInterface_GetLimitDescriptionForId_Call) Return(_a0 *model.LoadControlLimitDescriptionDataType, _a1 error) *LoadControlCommonInterface_GetLimitDescriptionForId_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *LoadControlCommonInterface_GetLimitDescriptionForId_Call) RunAndReturn(run func(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error)) *LoadControlCommonInterface_GetLimitDescriptionForId_Call { +func (_c *LoadControlCommonInterface_GetLimitDescriptionForId_Call) RunAndReturn(run func(model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error)) *LoadControlCommonInterface_GetLimitDescriptionForId_Call { _c.Call.Return(run) return _c } -// GetLimitDescriptionsForFilter provides a mock function for the type LoadControlCommonInterface -func (_mock *LoadControlCommonInterface) GetLimitDescriptionsForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetLimitDescriptionsForFilter provides a mock function with given fields: filter +func (_m *LoadControlCommonInterface) GetLimitDescriptionsForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetLimitDescriptionsForFilter") @@ -289,21 +251,23 @@ func (_mock *LoadControlCommonInterface) GetLimitDescriptionsForFilter(filter mo var r0 []model.LoadControlLimitDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) []model.LoadControlLimitDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) []model.LoadControlLimitDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.LoadControlLimitDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.LoadControlLimitDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.LoadControlLimitDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -320,23 +284,31 @@ func (_e *LoadControlCommonInterface_Expecter) GetLimitDescriptionsForFilter(fil func (_c *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call) Run(run func(filter model.LoadControlLimitDescriptionDataType)) *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.LoadControlLimitDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.LoadControlLimitDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.LoadControlLimitDescriptionDataType)) }) return _c } -func (_c *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call) Return(loadControlLimitDescriptionDataTypes []model.LoadControlLimitDescriptionDataType, err error) *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call { - _c.Call.Return(loadControlLimitDescriptionDataTypes, err) +func (_c *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call) Return(_a0 []model.LoadControlLimitDescriptionDataType, _a1 error) *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call) RunAndReturn(run func(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error)) *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call { +func (_c *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call) RunAndReturn(run func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error)) *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call { _c.Call.Return(run) return _c } + +// NewLoadControlCommonInterface creates a new instance of LoadControlCommonInterface. 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 NewLoadControlCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *LoadControlCommonInterface { + mock := &LoadControlCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/LoadControlServerInterface.go b/mocks/LoadControlServerInterface.go index 902d3e0d..2f404640 100644 --- a/mocks/LoadControlServerInterface.go +++ b/mocks/LoadControlServerInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/model" + api "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) - -// NewLoadControlServerInterface creates a new instance of LoadControlServerInterface. 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 NewLoadControlServerInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *LoadControlServerInterface { - mock := &LoadControlServerInterface{} - mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + model "github.com/enbility/spine-go/model" +) // LoadControlServerInterface is an autogenerated mock type for the LoadControlServerInterface type type LoadControlServerInterface struct { @@ -37,22 +22,23 @@ func (_m *LoadControlServerInterface) EXPECT() *LoadControlServerInterface_Expec return &LoadControlServerInterface_Expecter{mock: &_m.Mock} } -// AddLimitDescription provides a mock function for the type LoadControlServerInterface -func (_mock *LoadControlServerInterface) AddLimitDescription(description model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType { - ret := _mock.Called(description) +// AddLimitDescription provides a mock function with given fields: description +func (_m *LoadControlServerInterface) AddLimitDescription(description model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType { + ret := _m.Called(description) if len(ret) == 0 { panic("no return value specified for AddLimitDescription") } var r0 *model.LoadControlLimitIdType - if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType); ok { - r0 = returnFunc(description) + if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType); ok { + r0 = rf(description) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.LoadControlLimitIdType) } } + return r0 } @@ -69,41 +55,36 @@ func (_e *LoadControlServerInterface_Expecter) AddLimitDescription(description i func (_c *LoadControlServerInterface_AddLimitDescription_Call) Run(run func(description model.LoadControlLimitDescriptionDataType)) *LoadControlServerInterface_AddLimitDescription_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.LoadControlLimitDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.LoadControlLimitDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.LoadControlLimitDescriptionDataType)) }) return _c } -func (_c *LoadControlServerInterface_AddLimitDescription_Call) Return(loadControlLimitIdType *model.LoadControlLimitIdType) *LoadControlServerInterface_AddLimitDescription_Call { - _c.Call.Return(loadControlLimitIdType) +func (_c *LoadControlServerInterface_AddLimitDescription_Call) Return(_a0 *model.LoadControlLimitIdType) *LoadControlServerInterface_AddLimitDescription_Call { + _c.Call.Return(_a0) return _c } -func (_c *LoadControlServerInterface_AddLimitDescription_Call) RunAndReturn(run func(description model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType) *LoadControlServerInterface_AddLimitDescription_Call { +func (_c *LoadControlServerInterface_AddLimitDescription_Call) RunAndReturn(run func(model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType) *LoadControlServerInterface_AddLimitDescription_Call { _c.Call.Return(run) return _c } -// UpdateLimitDataForFilter provides a mock function for the type LoadControlServerInterface -func (_mock *LoadControlServerInterface) UpdateLimitDataForFilter(data []api.LoadControlLimitDataForFilter, deleteSelector *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) error { - ret := _mock.Called(data, deleteSelector, deleteElements) +// UpdateLimitDataForFilter provides a mock function with given fields: data, deleteSelector, deleteElements +func (_m *LoadControlServerInterface) UpdateLimitDataForFilter(data []api.LoadControlLimitDataForFilter, deleteSelector *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) error { + ret := _m.Called(data, deleteSelector, deleteElements) if len(ret) == 0 { panic("no return value specified for UpdateLimitDataForFilter") } var r0 error - if returnFunc, ok := ret.Get(0).(func([]api.LoadControlLimitDataForFilter, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { - r0 = returnFunc(data, deleteSelector, deleteElements) + if rf, ok := ret.Get(0).(func([]api.LoadControlLimitDataForFilter, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { + r0 = rf(data, deleteSelector, deleteElements) } else { r0 = ret.Error(0) } + return r0 } @@ -122,51 +103,36 @@ func (_e *LoadControlServerInterface_Expecter) UpdateLimitDataForFilter(data int func (_c *LoadControlServerInterface_UpdateLimitDataForFilter_Call) Run(run func(data []api.LoadControlLimitDataForFilter, deleteSelector *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType)) *LoadControlServerInterface_UpdateLimitDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []api.LoadControlLimitDataForFilter - if args[0] != nil { - arg0 = args[0].([]api.LoadControlLimitDataForFilter) - } - var arg1 *model.LoadControlLimitListDataSelectorsType - if args[1] != nil { - arg1 = args[1].(*model.LoadControlLimitListDataSelectorsType) - } - var arg2 *model.LoadControlLimitDataElementsType - if args[2] != nil { - arg2 = args[2].(*model.LoadControlLimitDataElementsType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].([]api.LoadControlLimitDataForFilter), args[1].(*model.LoadControlLimitListDataSelectorsType), args[2].(*model.LoadControlLimitDataElementsType)) }) return _c } -func (_c *LoadControlServerInterface_UpdateLimitDataForFilter_Call) Return(err error) *LoadControlServerInterface_UpdateLimitDataForFilter_Call { - _c.Call.Return(err) +func (_c *LoadControlServerInterface_UpdateLimitDataForFilter_Call) Return(_a0 error) *LoadControlServerInterface_UpdateLimitDataForFilter_Call { + _c.Call.Return(_a0) return _c } -func (_c *LoadControlServerInterface_UpdateLimitDataForFilter_Call) RunAndReturn(run func(data []api.LoadControlLimitDataForFilter, deleteSelector *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) error) *LoadControlServerInterface_UpdateLimitDataForFilter_Call { +func (_c *LoadControlServerInterface_UpdateLimitDataForFilter_Call) RunAndReturn(run func([]api.LoadControlLimitDataForFilter, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error) *LoadControlServerInterface_UpdateLimitDataForFilter_Call { _c.Call.Return(run) return _c } -// UpdateLimitDataForIds provides a mock function for the type LoadControlServerInterface -func (_mock *LoadControlServerInterface) UpdateLimitDataForIds(data []api.LoadControlLimitDataForID) error { - ret := _mock.Called(data) +// UpdateLimitDataForIds provides a mock function with given fields: data +func (_m *LoadControlServerInterface) UpdateLimitDataForIds(data []api.LoadControlLimitDataForID) error { + ret := _m.Called(data) if len(ret) == 0 { panic("no return value specified for UpdateLimitDataForIds") } var r0 error - if returnFunc, ok := ret.Get(0).(func([]api.LoadControlLimitDataForID) error); ok { - r0 = returnFunc(data) + if rf, ok := ret.Get(0).(func([]api.LoadControlLimitDataForID) error); ok { + r0 = rf(data) } else { r0 = ret.Error(0) } + return r0 } @@ -183,23 +149,31 @@ func (_e *LoadControlServerInterface_Expecter) UpdateLimitDataForIds(data interf func (_c *LoadControlServerInterface_UpdateLimitDataForIds_Call) Run(run func(data []api.LoadControlLimitDataForID)) *LoadControlServerInterface_UpdateLimitDataForIds_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []api.LoadControlLimitDataForID - if args[0] != nil { - arg0 = args[0].([]api.LoadControlLimitDataForID) - } - run( - arg0, - ) + run(args[0].([]api.LoadControlLimitDataForID)) }) return _c } -func (_c *LoadControlServerInterface_UpdateLimitDataForIds_Call) Return(err error) *LoadControlServerInterface_UpdateLimitDataForIds_Call { - _c.Call.Return(err) +func (_c *LoadControlServerInterface_UpdateLimitDataForIds_Call) Return(_a0 error) *LoadControlServerInterface_UpdateLimitDataForIds_Call { + _c.Call.Return(_a0) return _c } -func (_c *LoadControlServerInterface_UpdateLimitDataForIds_Call) RunAndReturn(run func(data []api.LoadControlLimitDataForID) error) *LoadControlServerInterface_UpdateLimitDataForIds_Call { +func (_c *LoadControlServerInterface_UpdateLimitDataForIds_Call) RunAndReturn(run func([]api.LoadControlLimitDataForID) error) *LoadControlServerInterface_UpdateLimitDataForIds_Call { _c.Call.Return(run) return _c } + +// NewLoadControlServerInterface creates a new instance of LoadControlServerInterface. 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 NewLoadControlServerInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *LoadControlServerInterface { + mock := &LoadControlServerInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/MeasurementClientInterface.go b/mocks/MeasurementClientInterface.go index 4c3cdd92..9b7c08ac 100644 --- a/mocks/MeasurementClientInterface.go +++ b/mocks/MeasurementClientInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewMeasurementClientInterface creates a new instance of MeasurementClientInterface. 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 NewMeasurementClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MeasurementClientInterface { - mock := &MeasurementClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // MeasurementClientInterface is an autogenerated mock type for the MeasurementClientInterface type type MeasurementClientInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *MeasurementClientInterface) EXPECT() *MeasurementClientInterface_Expec return &MeasurementClientInterface_Expecter{mock: &_m.Mock} } -// RequestConstraints provides a mock function for the type MeasurementClientInterface -func (_mock *MeasurementClientInterface) RequestConstraints(selector *model.MeasurementConstraintsListDataSelectorsType, elements *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestConstraints provides a mock function with given fields: selector, elements +func (_m *MeasurementClientInterface) RequestConstraints(selector *model.MeasurementConstraintsListDataSelectorsType, elements *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestConstraints") @@ -46,21 +30,23 @@ func (_mock *MeasurementClientInterface) RequestConstraints(selector *model.Meas var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -78,35 +64,24 @@ func (_e *MeasurementClientInterface_Expecter) RequestConstraints(selector inter func (_c *MeasurementClientInterface_RequestConstraints_Call) Run(run func(selector *model.MeasurementConstraintsListDataSelectorsType, elements *model.MeasurementConstraintsDataElementsType)) *MeasurementClientInterface_RequestConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.MeasurementConstraintsListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.MeasurementConstraintsListDataSelectorsType) - } - var arg1 *model.MeasurementConstraintsDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.MeasurementConstraintsDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.MeasurementConstraintsListDataSelectorsType), args[1].(*model.MeasurementConstraintsDataElementsType)) }) return _c } -func (_c *MeasurementClientInterface_RequestConstraints_Call) Return(msgCounterType *model.MsgCounterType, err error) *MeasurementClientInterface_RequestConstraints_Call { - _c.Call.Return(msgCounterType, err) +func (_c *MeasurementClientInterface_RequestConstraints_Call) Return(_a0 *model.MsgCounterType, _a1 error) *MeasurementClientInterface_RequestConstraints_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MeasurementClientInterface_RequestConstraints_Call) RunAndReturn(run func(selector *model.MeasurementConstraintsListDataSelectorsType, elements *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestConstraints_Call { +func (_c *MeasurementClientInterface_RequestConstraints_Call) RunAndReturn(run func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestConstraints_Call { _c.Call.Return(run) return _c } -// RequestData provides a mock function for the type MeasurementClientInterface -func (_mock *MeasurementClientInterface) RequestData(selector *model.MeasurementListDataSelectorsType, elements *model.MeasurementDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestData provides a mock function with given fields: selector, elements +func (_m *MeasurementClientInterface) RequestData(selector *model.MeasurementListDataSelectorsType, elements *model.MeasurementDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestData") @@ -114,21 +89,23 @@ func (_mock *MeasurementClientInterface) RequestData(selector *model.Measurement var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -146,35 +123,24 @@ func (_e *MeasurementClientInterface_Expecter) RequestData(selector interface{}, func (_c *MeasurementClientInterface_RequestData_Call) Run(run func(selector *model.MeasurementListDataSelectorsType, elements *model.MeasurementDataElementsType)) *MeasurementClientInterface_RequestData_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.MeasurementListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.MeasurementListDataSelectorsType) - } - var arg1 *model.MeasurementDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.MeasurementDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.MeasurementListDataSelectorsType), args[1].(*model.MeasurementDataElementsType)) }) return _c } -func (_c *MeasurementClientInterface_RequestData_Call) Return(msgCounterType *model.MsgCounterType, err error) *MeasurementClientInterface_RequestData_Call { - _c.Call.Return(msgCounterType, err) +func (_c *MeasurementClientInterface_RequestData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *MeasurementClientInterface_RequestData_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MeasurementClientInterface_RequestData_Call) RunAndReturn(run func(selector *model.MeasurementListDataSelectorsType, elements *model.MeasurementDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestData_Call { +func (_c *MeasurementClientInterface_RequestData_Call) RunAndReturn(run func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestData_Call { _c.Call.Return(run) return _c } -// RequestDescriptions provides a mock function for the type MeasurementClientInterface -func (_mock *MeasurementClientInterface) RequestDescriptions(selector *model.MeasurementDescriptionListDataSelectorsType, elements *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestDescriptions provides a mock function with given fields: selector, elements +func (_m *MeasurementClientInterface) RequestDescriptions(selector *model.MeasurementDescriptionListDataSelectorsType, elements *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestDescriptions") @@ -182,21 +148,23 @@ func (_mock *MeasurementClientInterface) RequestDescriptions(selector *model.Mea var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -214,28 +182,31 @@ func (_e *MeasurementClientInterface_Expecter) RequestDescriptions(selector inte func (_c *MeasurementClientInterface_RequestDescriptions_Call) Run(run func(selector *model.MeasurementDescriptionListDataSelectorsType, elements *model.MeasurementDescriptionDataElementsType)) *MeasurementClientInterface_RequestDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.MeasurementDescriptionListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.MeasurementDescriptionListDataSelectorsType) - } - var arg1 *model.MeasurementDescriptionDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.MeasurementDescriptionDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.MeasurementDescriptionListDataSelectorsType), args[1].(*model.MeasurementDescriptionDataElementsType)) }) return _c } -func (_c *MeasurementClientInterface_RequestDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *MeasurementClientInterface_RequestDescriptions_Call { - _c.Call.Return(msgCounterType, err) +func (_c *MeasurementClientInterface_RequestDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *MeasurementClientInterface_RequestDescriptions_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MeasurementClientInterface_RequestDescriptions_Call) RunAndReturn(run func(selector *model.MeasurementDescriptionListDataSelectorsType, elements *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestDescriptions_Call { +func (_c *MeasurementClientInterface_RequestDescriptions_Call) RunAndReturn(run func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestDescriptions_Call { _c.Call.Return(run) return _c } + +// NewMeasurementClientInterface creates a new instance of MeasurementClientInterface. 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 NewMeasurementClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MeasurementClientInterface { + mock := &MeasurementClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/MeasurementCommonInterface.go b/mocks/MeasurementCommonInterface.go index 76af646f..083c9681 100644 --- a/mocks/MeasurementCommonInterface.go +++ b/mocks/MeasurementCommonInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewMeasurementCommonInterface creates a new instance of MeasurementCommonInterface. 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 NewMeasurementCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MeasurementCommonInterface { - mock := &MeasurementCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // MeasurementCommonInterface is an autogenerated mock type for the MeasurementCommonInterface type type MeasurementCommonInterface struct { mock.Mock @@ -36,20 +20,21 @@ func (_m *MeasurementCommonInterface) EXPECT() *MeasurementCommonInterface_Expec return &MeasurementCommonInterface_Expecter{mock: &_m.Mock} } -// CheckEventPayloadDataForFilter provides a mock function for the type MeasurementCommonInterface -func (_mock *MeasurementCommonInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { - ret := _mock.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter +func (_m *MeasurementCommonInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { + ret := _m.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { - r0 = returnFunc(payloadData, filter) + if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { + r0 = rf(payloadData, filter) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -59,43 +44,32 @@ type MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call struct { } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData any -// - filter any +// - payloadData interface{} +// - filter interface{} func (_e *MeasurementCommonInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { return &MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 any - if args[0] != nil { - arg0 = args[0].(any) - } - var arg1 any - if args[1] != nil { - arg1 = args[1].(any) - } - run( - arg0, - arg1, - ) + run(args[0].(interface{}), args[1].(interface{})) }) return _c } -func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(b) +func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(_a0) return _c } -func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetConstraintsForFilter provides a mock function for the type MeasurementCommonInterface -func (_mock *MeasurementCommonInterface) GetConstraintsForFilter(filter model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error) { - ret := _mock.Called(filter) +// GetConstraintsForFilter provides a mock function with given fields: filter +func (_m *MeasurementCommonInterface) GetConstraintsForFilter(filter model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetConstraintsForFilter") @@ -103,21 +77,23 @@ func (_mock *MeasurementCommonInterface) GetConstraintsForFilter(filter model.Me var r0 []model.MeasurementConstraintsDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.MeasurementConstraintsDataType) []model.MeasurementConstraintsDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.MeasurementConstraintsDataType) []model.MeasurementConstraintsDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.MeasurementConstraintsDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.MeasurementConstraintsDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.MeasurementConstraintsDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -134,30 +110,24 @@ func (_e *MeasurementCommonInterface_Expecter) GetConstraintsForFilter(filter in func (_c *MeasurementCommonInterface_GetConstraintsForFilter_Call) Run(run func(filter model.MeasurementConstraintsDataType)) *MeasurementCommonInterface_GetConstraintsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.MeasurementConstraintsDataType - if args[0] != nil { - arg0 = args[0].(model.MeasurementConstraintsDataType) - } - run( - arg0, - ) + run(args[0].(model.MeasurementConstraintsDataType)) }) return _c } -func (_c *MeasurementCommonInterface_GetConstraintsForFilter_Call) Return(measurementConstraintsDataTypes []model.MeasurementConstraintsDataType, err error) *MeasurementCommonInterface_GetConstraintsForFilter_Call { - _c.Call.Return(measurementConstraintsDataTypes, err) +func (_c *MeasurementCommonInterface_GetConstraintsForFilter_Call) Return(_a0 []model.MeasurementConstraintsDataType, _a1 error) *MeasurementCommonInterface_GetConstraintsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MeasurementCommonInterface_GetConstraintsForFilter_Call) RunAndReturn(run func(filter model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error)) *MeasurementCommonInterface_GetConstraintsForFilter_Call { +func (_c *MeasurementCommonInterface_GetConstraintsForFilter_Call) RunAndReturn(run func(model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error)) *MeasurementCommonInterface_GetConstraintsForFilter_Call { _c.Call.Return(run) return _c } -// GetDataForFilter provides a mock function for the type MeasurementCommonInterface -func (_mock *MeasurementCommonInterface) GetDataForFilter(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error) { - ret := _mock.Called(filter) +// GetDataForFilter provides a mock function with given fields: filter +func (_m *MeasurementCommonInterface) GetDataForFilter(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDataForFilter") @@ -165,21 +135,23 @@ func (_mock *MeasurementCommonInterface) GetDataForFilter(filter model.Measureme var r0 []model.MeasurementDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) []model.MeasurementDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) []model.MeasurementDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.MeasurementDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.MeasurementDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.MeasurementDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -196,30 +168,24 @@ func (_e *MeasurementCommonInterface_Expecter) GetDataForFilter(filter interface func (_c *MeasurementCommonInterface_GetDataForFilter_Call) Run(run func(filter model.MeasurementDescriptionDataType)) *MeasurementCommonInterface_GetDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.MeasurementDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.MeasurementDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.MeasurementDescriptionDataType)) }) return _c } -func (_c *MeasurementCommonInterface_GetDataForFilter_Call) Return(measurementDataTypes []model.MeasurementDataType, err error) *MeasurementCommonInterface_GetDataForFilter_Call { - _c.Call.Return(measurementDataTypes, err) +func (_c *MeasurementCommonInterface_GetDataForFilter_Call) Return(_a0 []model.MeasurementDataType, _a1 error) *MeasurementCommonInterface_GetDataForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MeasurementCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error)) *MeasurementCommonInterface_GetDataForFilter_Call { +func (_c *MeasurementCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error)) *MeasurementCommonInterface_GetDataForFilter_Call { _c.Call.Return(run) return _c } -// GetDataForId provides a mock function for the type MeasurementCommonInterface -func (_mock *MeasurementCommonInterface) GetDataForId(measurementId model.MeasurementIdType) (*model.MeasurementDataType, error) { - ret := _mock.Called(measurementId) +// GetDataForId provides a mock function with given fields: measurementId +func (_m *MeasurementCommonInterface) GetDataForId(measurementId model.MeasurementIdType) (*model.MeasurementDataType, error) { + ret := _m.Called(measurementId) if len(ret) == 0 { panic("no return value specified for GetDataForId") @@ -227,21 +193,23 @@ func (_mock *MeasurementCommonInterface) GetDataForId(measurementId model.Measur var r0 *model.MeasurementDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.MeasurementIdType) (*model.MeasurementDataType, error)); ok { - return returnFunc(measurementId) + if rf, ok := ret.Get(0).(func(model.MeasurementIdType) (*model.MeasurementDataType, error)); ok { + return rf(measurementId) } - if returnFunc, ok := ret.Get(0).(func(model.MeasurementIdType) *model.MeasurementDataType); ok { - r0 = returnFunc(measurementId) + if rf, ok := ret.Get(0).(func(model.MeasurementIdType) *model.MeasurementDataType); ok { + r0 = rf(measurementId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MeasurementDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.MeasurementIdType) error); ok { - r1 = returnFunc(measurementId) + + if rf, ok := ret.Get(1).(func(model.MeasurementIdType) error); ok { + r1 = rf(measurementId) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -258,30 +226,24 @@ func (_e *MeasurementCommonInterface_Expecter) GetDataForId(measurementId interf func (_c *MeasurementCommonInterface_GetDataForId_Call) Run(run func(measurementId model.MeasurementIdType)) *MeasurementCommonInterface_GetDataForId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.MeasurementIdType - if args[0] != nil { - arg0 = args[0].(model.MeasurementIdType) - } - run( - arg0, - ) + run(args[0].(model.MeasurementIdType)) }) return _c } -func (_c *MeasurementCommonInterface_GetDataForId_Call) Return(measurementDataType *model.MeasurementDataType, err error) *MeasurementCommonInterface_GetDataForId_Call { - _c.Call.Return(measurementDataType, err) +func (_c *MeasurementCommonInterface_GetDataForId_Call) Return(_a0 *model.MeasurementDataType, _a1 error) *MeasurementCommonInterface_GetDataForId_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MeasurementCommonInterface_GetDataForId_Call) RunAndReturn(run func(measurementId model.MeasurementIdType) (*model.MeasurementDataType, error)) *MeasurementCommonInterface_GetDataForId_Call { +func (_c *MeasurementCommonInterface_GetDataForId_Call) RunAndReturn(run func(model.MeasurementIdType) (*model.MeasurementDataType, error)) *MeasurementCommonInterface_GetDataForId_Call { _c.Call.Return(run) return _c } -// GetDescriptionForId provides a mock function for the type MeasurementCommonInterface -func (_mock *MeasurementCommonInterface) GetDescriptionForId(measurementId model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error) { - ret := _mock.Called(measurementId) +// GetDescriptionForId provides a mock function with given fields: measurementId +func (_m *MeasurementCommonInterface) GetDescriptionForId(measurementId model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error) { + ret := _m.Called(measurementId) if len(ret) == 0 { panic("no return value specified for GetDescriptionForId") @@ -289,21 +251,23 @@ func (_mock *MeasurementCommonInterface) GetDescriptionForId(measurementId model var r0 *model.MeasurementDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error)); ok { - return returnFunc(measurementId) + if rf, ok := ret.Get(0).(func(model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error)); ok { + return rf(measurementId) } - if returnFunc, ok := ret.Get(0).(func(model.MeasurementIdType) *model.MeasurementDescriptionDataType); ok { - r0 = returnFunc(measurementId) + if rf, ok := ret.Get(0).(func(model.MeasurementIdType) *model.MeasurementDescriptionDataType); ok { + r0 = rf(measurementId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MeasurementDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.MeasurementIdType) error); ok { - r1 = returnFunc(measurementId) + + if rf, ok := ret.Get(1).(func(model.MeasurementIdType) error); ok { + r1 = rf(measurementId) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -320,30 +284,24 @@ func (_e *MeasurementCommonInterface_Expecter) GetDescriptionForId(measurementId func (_c *MeasurementCommonInterface_GetDescriptionForId_Call) Run(run func(measurementId model.MeasurementIdType)) *MeasurementCommonInterface_GetDescriptionForId_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.MeasurementIdType - if args[0] != nil { - arg0 = args[0].(model.MeasurementIdType) - } - run( - arg0, - ) + run(args[0].(model.MeasurementIdType)) }) return _c } -func (_c *MeasurementCommonInterface_GetDescriptionForId_Call) Return(measurementDescriptionDataType *model.MeasurementDescriptionDataType, err error) *MeasurementCommonInterface_GetDescriptionForId_Call { - _c.Call.Return(measurementDescriptionDataType, err) +func (_c *MeasurementCommonInterface_GetDescriptionForId_Call) Return(_a0 *model.MeasurementDescriptionDataType, _a1 error) *MeasurementCommonInterface_GetDescriptionForId_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MeasurementCommonInterface_GetDescriptionForId_Call) RunAndReturn(run func(measurementId model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error)) *MeasurementCommonInterface_GetDescriptionForId_Call { +func (_c *MeasurementCommonInterface_GetDescriptionForId_Call) RunAndReturn(run func(model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error)) *MeasurementCommonInterface_GetDescriptionForId_Call { _c.Call.Return(run) return _c } -// GetDescriptionsForFilter provides a mock function for the type MeasurementCommonInterface -func (_mock *MeasurementCommonInterface) GetDescriptionsForFilter(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetDescriptionsForFilter provides a mock function with given fields: filter +func (_m *MeasurementCommonInterface) GetDescriptionsForFilter(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionsForFilter") @@ -351,21 +309,23 @@ func (_mock *MeasurementCommonInterface) GetDescriptionsForFilter(filter model.M var r0 []model.MeasurementDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) []model.MeasurementDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) []model.MeasurementDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.MeasurementDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.MeasurementDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.MeasurementDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -382,23 +342,31 @@ func (_e *MeasurementCommonInterface_Expecter) GetDescriptionsForFilter(filter i func (_c *MeasurementCommonInterface_GetDescriptionsForFilter_Call) Run(run func(filter model.MeasurementDescriptionDataType)) *MeasurementCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.MeasurementDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.MeasurementDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.MeasurementDescriptionDataType)) }) return _c } -func (_c *MeasurementCommonInterface_GetDescriptionsForFilter_Call) Return(measurementDescriptionDataTypes []model.MeasurementDescriptionDataType, err error) *MeasurementCommonInterface_GetDescriptionsForFilter_Call { - _c.Call.Return(measurementDescriptionDataTypes, err) +func (_c *MeasurementCommonInterface_GetDescriptionsForFilter_Call) Return(_a0 []model.MeasurementDescriptionDataType, _a1 error) *MeasurementCommonInterface_GetDescriptionsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MeasurementCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error)) *MeasurementCommonInterface_GetDescriptionsForFilter_Call { +func (_c *MeasurementCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error)) *MeasurementCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Return(run) return _c } + +// NewMeasurementCommonInterface creates a new instance of MeasurementCommonInterface. 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 NewMeasurementCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MeasurementCommonInterface { + mock := &MeasurementCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/MeasurementServerInterface.go b/mocks/MeasurementServerInterface.go index 81683c75..1518bc1b 100644 --- a/mocks/MeasurementServerInterface.go +++ b/mocks/MeasurementServerInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/model" + api "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) - -// NewMeasurementServerInterface creates a new instance of MeasurementServerInterface. 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 NewMeasurementServerInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MeasurementServerInterface { - mock := &MeasurementServerInterface{} - mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + model "github.com/enbility/spine-go/model" +) // MeasurementServerInterface is an autogenerated mock type for the MeasurementServerInterface type type MeasurementServerInterface struct { @@ -37,22 +22,23 @@ func (_m *MeasurementServerInterface) EXPECT() *MeasurementServerInterface_Expec return &MeasurementServerInterface_Expecter{mock: &_m.Mock} } -// AddDescription provides a mock function for the type MeasurementServerInterface -func (_mock *MeasurementServerInterface) AddDescription(description model.MeasurementDescriptionDataType) *model.MeasurementIdType { - ret := _mock.Called(description) +// AddDescription provides a mock function with given fields: description +func (_m *MeasurementServerInterface) AddDescription(description model.MeasurementDescriptionDataType) *model.MeasurementIdType { + ret := _m.Called(description) if len(ret) == 0 { panic("no return value specified for AddDescription") } var r0 *model.MeasurementIdType - if returnFunc, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) *model.MeasurementIdType); ok { - r0 = returnFunc(description) + if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) *model.MeasurementIdType); ok { + r0 = rf(description) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MeasurementIdType) } } + return r0 } @@ -69,41 +55,36 @@ func (_e *MeasurementServerInterface_Expecter) AddDescription(description interf func (_c *MeasurementServerInterface_AddDescription_Call) Run(run func(description model.MeasurementDescriptionDataType)) *MeasurementServerInterface_AddDescription_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.MeasurementDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.MeasurementDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.MeasurementDescriptionDataType)) }) return _c } -func (_c *MeasurementServerInterface_AddDescription_Call) Return(measurementIdType *model.MeasurementIdType) *MeasurementServerInterface_AddDescription_Call { - _c.Call.Return(measurementIdType) +func (_c *MeasurementServerInterface_AddDescription_Call) Return(_a0 *model.MeasurementIdType) *MeasurementServerInterface_AddDescription_Call { + _c.Call.Return(_a0) return _c } -func (_c *MeasurementServerInterface_AddDescription_Call) RunAndReturn(run func(description model.MeasurementDescriptionDataType) *model.MeasurementIdType) *MeasurementServerInterface_AddDescription_Call { +func (_c *MeasurementServerInterface_AddDescription_Call) RunAndReturn(run func(model.MeasurementDescriptionDataType) *model.MeasurementIdType) *MeasurementServerInterface_AddDescription_Call { _c.Call.Return(run) return _c } -// UpdateDataForFilters provides a mock function for the type MeasurementServerInterface -func (_mock *MeasurementServerInterface) UpdateDataForFilters(data []api.MeasurementDataForFilter, deleteSelector *model.MeasurementListDataSelectorsType, deleteElements *model.MeasurementDataElementsType) error { - ret := _mock.Called(data, deleteSelector, deleteElements) +// UpdateDataForFilters provides a mock function with given fields: data, deleteSelector, deleteElements +func (_m *MeasurementServerInterface) UpdateDataForFilters(data []api.MeasurementDataForFilter, deleteSelector *model.MeasurementListDataSelectorsType, deleteElements *model.MeasurementDataElementsType) error { + ret := _m.Called(data, deleteSelector, deleteElements) if len(ret) == 0 { panic("no return value specified for UpdateDataForFilters") } var r0 error - if returnFunc, ok := ret.Get(0).(func([]api.MeasurementDataForFilter, *model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) error); ok { - r0 = returnFunc(data, deleteSelector, deleteElements) + if rf, ok := ret.Get(0).(func([]api.MeasurementDataForFilter, *model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) error); ok { + r0 = rf(data, deleteSelector, deleteElements) } else { r0 = ret.Error(0) } + return r0 } @@ -122,51 +103,36 @@ func (_e *MeasurementServerInterface_Expecter) UpdateDataForFilters(data interfa func (_c *MeasurementServerInterface_UpdateDataForFilters_Call) Run(run func(data []api.MeasurementDataForFilter, deleteSelector *model.MeasurementListDataSelectorsType, deleteElements *model.MeasurementDataElementsType)) *MeasurementServerInterface_UpdateDataForFilters_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []api.MeasurementDataForFilter - if args[0] != nil { - arg0 = args[0].([]api.MeasurementDataForFilter) - } - var arg1 *model.MeasurementListDataSelectorsType - if args[1] != nil { - arg1 = args[1].(*model.MeasurementListDataSelectorsType) - } - var arg2 *model.MeasurementDataElementsType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementDataElementsType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].([]api.MeasurementDataForFilter), args[1].(*model.MeasurementListDataSelectorsType), args[2].(*model.MeasurementDataElementsType)) }) return _c } -func (_c *MeasurementServerInterface_UpdateDataForFilters_Call) Return(err error) *MeasurementServerInterface_UpdateDataForFilters_Call { - _c.Call.Return(err) +func (_c *MeasurementServerInterface_UpdateDataForFilters_Call) Return(_a0 error) *MeasurementServerInterface_UpdateDataForFilters_Call { + _c.Call.Return(_a0) return _c } -func (_c *MeasurementServerInterface_UpdateDataForFilters_Call) RunAndReturn(run func(data []api.MeasurementDataForFilter, deleteSelector *model.MeasurementListDataSelectorsType, deleteElements *model.MeasurementDataElementsType) error) *MeasurementServerInterface_UpdateDataForFilters_Call { +func (_c *MeasurementServerInterface_UpdateDataForFilters_Call) RunAndReturn(run func([]api.MeasurementDataForFilter, *model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) error) *MeasurementServerInterface_UpdateDataForFilters_Call { _c.Call.Return(run) return _c } -// UpdateDataForIds provides a mock function for the type MeasurementServerInterface -func (_mock *MeasurementServerInterface) UpdateDataForIds(data []api.MeasurementDataForID) error { - ret := _mock.Called(data) +// UpdateDataForIds provides a mock function with given fields: data +func (_m *MeasurementServerInterface) UpdateDataForIds(data []api.MeasurementDataForID) error { + ret := _m.Called(data) if len(ret) == 0 { panic("no return value specified for UpdateDataForIds") } var r0 error - if returnFunc, ok := ret.Get(0).(func([]api.MeasurementDataForID) error); ok { - r0 = returnFunc(data) + if rf, ok := ret.Get(0).(func([]api.MeasurementDataForID) error); ok { + r0 = rf(data) } else { r0 = ret.Error(0) } + return r0 } @@ -183,23 +149,31 @@ func (_e *MeasurementServerInterface_Expecter) UpdateDataForIds(data interface{} func (_c *MeasurementServerInterface_UpdateDataForIds_Call) Run(run func(data []api.MeasurementDataForID)) *MeasurementServerInterface_UpdateDataForIds_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []api.MeasurementDataForID - if args[0] != nil { - arg0 = args[0].([]api.MeasurementDataForID) - } - run( - arg0, - ) + run(args[0].([]api.MeasurementDataForID)) }) return _c } -func (_c *MeasurementServerInterface_UpdateDataForIds_Call) Return(err error) *MeasurementServerInterface_UpdateDataForIds_Call { - _c.Call.Return(err) +func (_c *MeasurementServerInterface_UpdateDataForIds_Call) Return(_a0 error) *MeasurementServerInterface_UpdateDataForIds_Call { + _c.Call.Return(_a0) return _c } -func (_c *MeasurementServerInterface_UpdateDataForIds_Call) RunAndReturn(run func(data []api.MeasurementDataForID) error) *MeasurementServerInterface_UpdateDataForIds_Call { +func (_c *MeasurementServerInterface_UpdateDataForIds_Call) RunAndReturn(run func([]api.MeasurementDataForID) error) *MeasurementServerInterface_UpdateDataForIds_Call { _c.Call.Return(run) return _c } + +// NewMeasurementServerInterface creates a new instance of MeasurementServerInterface. 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 NewMeasurementServerInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MeasurementServerInterface { + mock := &MeasurementServerInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/ServiceInterface.go b/mocks/ServiceInterface.go index 3b0f3a7e..05c6003d 100644 --- a/mocks/ServiceInterface.go +++ b/mocks/ServiceInterface.go @@ -1,6 +1,4 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks @@ -10,21 +8,11 @@ import ( "github.com/enbility/ship-go/logging" api1 "github.com/enbility/spine-go/api" mock "github.com/stretchr/testify/mock" -) -// NewServiceInterface creates a new instance of ServiceInterface. 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 NewServiceInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *ServiceInterface { - mock := &ServiceInterface{} - mock.Mock.Test(t) + ship_goapi "github.com/enbility/ship-go/api" - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // ServiceInterface is an autogenerated mock type for the ServiceInterface type type ServiceInterface struct { @@ -39,20 +27,21 @@ func (_m *ServiceInterface) EXPECT() *ServiceInterface_Expecter { return &ServiceInterface_Expecter{mock: &_m.Mock} } -// AddUseCase provides a mock function for the type ServiceInterface -func (_mock *ServiceInterface) AddUseCase(useCase api.UseCaseInterface) error { - ret := _mock.Called(useCase) +// AddUseCase provides a mock function with given fields: useCase +func (_m *ServiceInterface) AddUseCase(useCase api.UseCaseInterface) error { + ret := _m.Called(useCase) if len(ret) == 0 { panic("no return value specified for AddUseCase") } var r0 error - if returnFunc, ok := ret.Get(0).(func(api.UseCaseInterface) error); ok { - r0 = returnFunc(useCase) + if rf, ok := ret.Get(0).(func(api.UseCaseInterface) error); ok { + r0 = rf(useCase) } else { r0 = ret.Error(0) } + return r0 } @@ -69,23 +58,17 @@ func (_e *ServiceInterface_Expecter) AddUseCase(useCase interface{}) *ServiceInt func (_c *ServiceInterface_AddUseCase_Call) Run(run func(useCase api.UseCaseInterface)) *ServiceInterface_AddUseCase_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.UseCaseInterface - if args[0] != nil { - arg0 = args[0].(api.UseCaseInterface) - } - run( - arg0, - ) + run(args[0].(api.UseCaseInterface)) }) return _c } -func (_c *ServiceInterface_AddUseCase_Call) Return(err error) *ServiceInterface_AddUseCase_Call { - _c.Call.Return(err) +func (_c *ServiceInterface_AddUseCase_Call) Return(_a0 error) *ServiceInterface_AddUseCase_Call { + _c.Call.Return(_a0) return _c } -func (_c *ServiceInterface_AddUseCase_Call) RunAndReturn(run func(useCase api.UseCaseInterface) error) *ServiceInterface_AddUseCase_Call { +func (_c *ServiceInterface_AddUseCase_Call) RunAndReturn(run func(api.UseCaseInterface) error) *ServiceInterface_AddUseCase_Call { _c.Call.Return(run) return _c } @@ -130,22 +113,23 @@ func (_c *ServiceInterface_CancelPairing_Call) RunAndReturn(run func(identity ap return _c } -// Configuration provides a mock function for the type ServiceInterface -func (_mock *ServiceInterface) Configuration() *api.Configuration { - ret := _mock.Called() +// Configuration provides a mock function with no fields +func (_m *ServiceInterface) Configuration() *api.Configuration { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for Configuration") } var r0 *api.Configuration - if returnFunc, ok := ret.Get(0).(func() *api.Configuration); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *api.Configuration); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*api.Configuration) } } + return r0 } @@ -166,8 +150,8 @@ func (_c *ServiceInterface_Configuration_Call) Run(run func()) *ServiceInterface return _c } -func (_c *ServiceInterface_Configuration_Call) Return(configuration *api.Configuration) *ServiceInterface_Configuration_Call { - _c.Call.Return(configuration) +func (_c *ServiceInterface_Configuration_Call) Return(_a0 *api.Configuration) *ServiceInterface_Configuration_Call { + _c.Call.Return(_a0) return _c } @@ -427,11 +411,12 @@ func (_mock *ServiceInterface) IsAutoAcceptEnabled() bool { } var r0 bool - if returnFunc, ok := ret.Get(0).(func() bool); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -452,8 +437,8 @@ func (_c *ServiceInterface_IsAutoAcceptEnabled_Call) Run(run func()) *ServiceInt return _c } -func (_c *ServiceInterface_IsAutoAcceptEnabled_Call) Return(b bool) *ServiceInterface_IsAutoAcceptEnabled_Call { - _c.Call.Return(b) +func (_c *ServiceInterface_IsAutoAcceptEnabled_Call) Return(_a0 bool) *ServiceInterface_IsAutoAcceptEnabled_Call { + _c.Call.Return(_a0) return _c } @@ -462,20 +447,21 @@ func (_c *ServiceInterface_IsAutoAcceptEnabled_Call) RunAndReturn(run func() boo return _c } -// IsRunning provides a mock function for the type ServiceInterface -func (_mock *ServiceInterface) IsRunning() bool { - ret := _mock.Called() +// IsRunning provides a mock function with no fields +func (_m *ServiceInterface) IsRunning() bool { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for IsRunning") } var r0 bool - if returnFunc, ok := ret.Get(0).(func() bool); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -496,8 +482,8 @@ func (_c *ServiceInterface_IsRunning_Call) Run(run func()) *ServiceInterface_IsR return _c } -func (_c *ServiceInterface_IsRunning_Call) Return(b bool) *ServiceInterface_IsRunning_Call { - _c.Call.Return(b) +func (_c *ServiceInterface_IsRunning_Call) Return(_a0 bool) *ServiceInterface_IsRunning_Call { + _c.Call.Return(_a0) return _c } @@ -522,6 +508,7 @@ func (_mock *ServiceInterface) LocalDevice() api1.DeviceLocalInterface { r0 = ret.Get(0).(api1.DeviceLocalInterface) } } + return r0 } @@ -568,6 +555,7 @@ func (_mock *ServiceInterface) LocalService() *api0.ServiceDetails { r0 = ret.Get(0).(*api0.ServiceDetails) } } + return r0 } @@ -614,6 +602,7 @@ func (_mock *ServiceInterface) PairingDetailFor(identity api0.ServiceIdentity) * r0 = ret.Get(0).(*api0.ConnectionStateDetail) } } + return r0 } @@ -760,6 +749,7 @@ func (_mock *ServiceInterface) RemoteServiceFor(identity api0.ServiceIdentity) * r0 = ret.Get(0).(*api0.ServiceDetails) } } + return r0 } @@ -797,10 +787,9 @@ func (_c *ServiceInterface_RemoteServiceFor_Call) RunAndReturn(run func(identity return _c } -// SetAutoAccept provides a mock function for the type ServiceInterface -func (_mock *ServiceInterface) SetAutoAccept(value bool) { - _mock.Called(value) - return +// SetAutoAccept provides a mock function with given fields: value +func (_m *ServiceInterface) SetAutoAccept(value bool) { + _m.Called(value) } // ServiceInterface_SetAutoAccept_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetAutoAccept' @@ -816,13 +805,7 @@ func (_e *ServiceInterface_Expecter) SetAutoAccept(value interface{}) *ServiceIn func (_c *ServiceInterface_SetAutoAccept_Call) Run(run func(value bool)) *ServiceInterface_SetAutoAccept_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -832,15 +815,14 @@ func (_c *ServiceInterface_SetAutoAccept_Call) Return() *ServiceInterface_SetAut return _c } -func (_c *ServiceInterface_SetAutoAccept_Call) RunAndReturn(run func(value bool)) *ServiceInterface_SetAutoAccept_Call { +func (_c *ServiceInterface_SetAutoAccept_Call) RunAndReturn(run func(bool)) *ServiceInterface_SetAutoAccept_Call { _c.Run(run) return _c } -// SetLogging provides a mock function for the type ServiceInterface -func (_mock *ServiceInterface) SetLogging(logger logging.LoggingInterface) { - _mock.Called(logger) - return +// SetLogging provides a mock function with given fields: logger +func (_m *ServiceInterface) SetLogging(logger logging.LoggingInterface) { + _m.Called(logger) } // ServiceInterface_SetLogging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetLogging' @@ -856,13 +838,7 @@ func (_e *ServiceInterface_Expecter) SetLogging(logger interface{}) *ServiceInte func (_c *ServiceInterface_SetLogging_Call) Run(run func(logger logging.LoggingInterface)) *ServiceInterface_SetLogging_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 logging.LoggingInterface - if args[0] != nil { - arg0 = args[0].(logging.LoggingInterface) - } - run( - arg0, - ) + run(args[0].(logging.LoggingInterface)) }) return _c } @@ -872,25 +848,26 @@ func (_c *ServiceInterface_SetLogging_Call) Return() *ServiceInterface_SetLoggin return _c } -func (_c *ServiceInterface_SetLogging_Call) RunAndReturn(run func(logger logging.LoggingInterface)) *ServiceInterface_SetLogging_Call { +func (_c *ServiceInterface_SetLogging_Call) RunAndReturn(run func(logging.LoggingInterface)) *ServiceInterface_SetLogging_Call { _c.Run(run) return _c } -// Setup provides a mock function for the type ServiceInterface -func (_mock *ServiceInterface) Setup() error { - ret := _mock.Called() +// Setup provides a mock function with no fields +func (_m *ServiceInterface) Setup() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for Setup") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -911,8 +888,8 @@ func (_c *ServiceInterface_Setup_Call) Run(run func()) *ServiceInterface_Setup_C return _c } -func (_c *ServiceInterface_Setup_Call) Return(err error) *ServiceInterface_Setup_Call { - _c.Call.Return(err) +func (_c *ServiceInterface_Setup_Call) Return(_a0 error) *ServiceInterface_Setup_Call { + _c.Call.Return(_a0) return _c } @@ -921,10 +898,9 @@ func (_c *ServiceInterface_Setup_Call) RunAndReturn(run func() error) *ServiceIn return _c } -// Shutdown provides a mock function for the type ServiceInterface -func (_mock *ServiceInterface) Shutdown() { - _mock.Called() - return +// Shutdown provides a mock function with no fields +func (_m *ServiceInterface) Shutdown() { + _m.Called() } // ServiceInterface_Shutdown_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Shutdown' @@ -1140,10 +1116,9 @@ func (_c *ServiceInterface_UnregisterRemoteService_Call) RunAndReturn(run func(i return _c } -// UserIsAbleToApproveOrCancelPairingRequests provides a mock function for the type ServiceInterface -func (_mock *ServiceInterface) UserIsAbleToApproveOrCancelPairingRequests(allow bool) { - _mock.Called(allow) - return +// UserIsAbleToApproveOrCancelPairingRequests provides a mock function with given fields: allow +func (_m *ServiceInterface) UserIsAbleToApproveOrCancelPairingRequests(allow bool) { + _m.Called(allow) } // ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UserIsAbleToApproveOrCancelPairingRequests' @@ -1159,13 +1134,7 @@ func (_e *ServiceInterface_Expecter) UserIsAbleToApproveOrCancelPairingRequests( func (_c *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call) Run(run func(allow bool)) *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -1175,7 +1144,21 @@ func (_c *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call) Retu return _c } -func (_c *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call) RunAndReturn(run func(allow bool)) *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call { +func (_c *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call) RunAndReturn(run func(bool)) *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call { _c.Run(run) return _c } + +// NewServiceInterface creates a new instance of ServiceInterface. 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 NewServiceInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *ServiceInterface { + mock := &ServiceInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/ServiceReaderInterface.go b/mocks/ServiceReaderInterface.go index c39a64a2..42dc1ec8 100644 --- a/mocks/ServiceReaderInterface.go +++ b/mocks/ServiceReaderInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/eebus-go/api" - api0 "github.com/enbility/ship-go/api" + api "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) -// NewServiceReaderInterface creates a new instance of ServiceReaderInterface. 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 NewServiceReaderInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *ServiceReaderInterface { - mock := &ServiceReaderInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + ship_goapi "github.com/enbility/ship-go/api" +) // ServiceReaderInterface is an autogenerated mock type for the ServiceReaderInterface type type ServiceReaderInterface struct { @@ -410,3 +395,17 @@ func (_c *ServiceReaderInterface_VisibleRemoteMdnsServicesUpdated_Call) RunAndRe _c.Run(run) return _c } + +// NewServiceReaderInterface creates a new instance of ServiceReaderInterface. 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 NewServiceReaderInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *ServiceReaderInterface { + mock := &ServiceReaderInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/SmartEnergyManagementPsClientInterface.go b/mocks/SmartEnergyManagementPsClientInterface.go index 743c9117..fa95fe36 100644 --- a/mocks/SmartEnergyManagementPsClientInterface.go +++ b/mocks/SmartEnergyManagementPsClientInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewSmartEnergyManagementPsClientInterface creates a new instance of SmartEnergyManagementPsClientInterface. 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 NewSmartEnergyManagementPsClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *SmartEnergyManagementPsClientInterface { - mock := &SmartEnergyManagementPsClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // SmartEnergyManagementPsClientInterface is an autogenerated mock type for the SmartEnergyManagementPsClientInterface type type SmartEnergyManagementPsClientInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *SmartEnergyManagementPsClientInterface) EXPECT() *SmartEnergyManagemen return &SmartEnergyManagementPsClientInterface_Expecter{mock: &_m.Mock} } -// RequestData provides a mock function for the type SmartEnergyManagementPsClientInterface -func (_mock *SmartEnergyManagementPsClientInterface) RequestData() (*model.MsgCounterType, error) { - ret := _mock.Called() +// RequestData provides a mock function with no fields +func (_m *SmartEnergyManagementPsClientInterface) RequestData() (*model.MsgCounterType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RequestData") @@ -46,21 +30,23 @@ func (_mock *SmartEnergyManagementPsClientInterface) RequestData() (*model.MsgCo var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -81,8 +67,8 @@ func (_c *SmartEnergyManagementPsClientInterface_RequestData_Call) Run(run func( return _c } -func (_c *SmartEnergyManagementPsClientInterface_RequestData_Call) Return(msgCounterType *model.MsgCounterType, err error) *SmartEnergyManagementPsClientInterface_RequestData_Call { - _c.Call.Return(msgCounterType, err) +func (_c *SmartEnergyManagementPsClientInterface_RequestData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *SmartEnergyManagementPsClientInterface_RequestData_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -91,9 +77,9 @@ func (_c *SmartEnergyManagementPsClientInterface_RequestData_Call) RunAndReturn( return _c } -// WriteData provides a mock function for the type SmartEnergyManagementPsClientInterface -func (_mock *SmartEnergyManagementPsClientInterface) WriteData(data *model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error) { - ret := _mock.Called(data) +// WriteData provides a mock function with given fields: data +func (_m *SmartEnergyManagementPsClientInterface) WriteData(data *model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error) { + ret := _m.Called(data) if len(ret) == 0 { panic("no return value specified for WriteData") @@ -101,21 +87,23 @@ func (_mock *SmartEnergyManagementPsClientInterface) WriteData(data *model.Smart var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error)); ok { - return returnFunc(data) + if rf, ok := ret.Get(0).(func(*model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error)); ok { + return rf(data) } - if returnFunc, ok := ret.Get(0).(func(*model.SmartEnergyManagementPsDataType) *model.MsgCounterType); ok { - r0 = returnFunc(data) + if rf, ok := ret.Get(0).(func(*model.SmartEnergyManagementPsDataType) *model.MsgCounterType); ok { + r0 = rf(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.SmartEnergyManagementPsDataType) error); ok { - r1 = returnFunc(data) + + if rf, ok := ret.Get(1).(func(*model.SmartEnergyManagementPsDataType) error); ok { + r1 = rf(data) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -132,23 +120,31 @@ func (_e *SmartEnergyManagementPsClientInterface_Expecter) WriteData(data interf func (_c *SmartEnergyManagementPsClientInterface_WriteData_Call) Run(run func(data *model.SmartEnergyManagementPsDataType)) *SmartEnergyManagementPsClientInterface_WriteData_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.SmartEnergyManagementPsDataType - if args[0] != nil { - arg0 = args[0].(*model.SmartEnergyManagementPsDataType) - } - run( - arg0, - ) + run(args[0].(*model.SmartEnergyManagementPsDataType)) }) return _c } -func (_c *SmartEnergyManagementPsClientInterface_WriteData_Call) Return(msgCounterType *model.MsgCounterType, err error) *SmartEnergyManagementPsClientInterface_WriteData_Call { - _c.Call.Return(msgCounterType, err) +func (_c *SmartEnergyManagementPsClientInterface_WriteData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *SmartEnergyManagementPsClientInterface_WriteData_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *SmartEnergyManagementPsClientInterface_WriteData_Call) RunAndReturn(run func(data *model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error)) *SmartEnergyManagementPsClientInterface_WriteData_Call { +func (_c *SmartEnergyManagementPsClientInterface_WriteData_Call) RunAndReturn(run func(*model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error)) *SmartEnergyManagementPsClientInterface_WriteData_Call { _c.Call.Return(run) return _c } + +// NewSmartEnergyManagementPsClientInterface creates a new instance of SmartEnergyManagementPsClientInterface. 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 NewSmartEnergyManagementPsClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *SmartEnergyManagementPsClientInterface { + mock := &SmartEnergyManagementPsClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/SmartEnergyManagementPsCommonInterface.go b/mocks/SmartEnergyManagementPsCommonInterface.go index 9ad01737..6ffe4e1b 100644 --- a/mocks/SmartEnergyManagementPsCommonInterface.go +++ b/mocks/SmartEnergyManagementPsCommonInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewSmartEnergyManagementPsCommonInterface creates a new instance of SmartEnergyManagementPsCommonInterface. 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 NewSmartEnergyManagementPsCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *SmartEnergyManagementPsCommonInterface { - mock := &SmartEnergyManagementPsCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // SmartEnergyManagementPsCommonInterface is an autogenerated mock type for the SmartEnergyManagementPsCommonInterface type type SmartEnergyManagementPsCommonInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *SmartEnergyManagementPsCommonInterface) EXPECT() *SmartEnergyManagemen return &SmartEnergyManagementPsCommonInterface_Expecter{mock: &_m.Mock} } -// GetData provides a mock function for the type SmartEnergyManagementPsCommonInterface -func (_mock *SmartEnergyManagementPsCommonInterface) GetData() (*model.SmartEnergyManagementPsDataType, error) { - ret := _mock.Called() +// GetData provides a mock function with no fields +func (_m *SmartEnergyManagementPsCommonInterface) GetData() (*model.SmartEnergyManagementPsDataType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for GetData") @@ -46,21 +30,23 @@ func (_mock *SmartEnergyManagementPsCommonInterface) GetData() (*model.SmartEner var r0 *model.SmartEnergyManagementPsDataType var r1 error - if returnFunc, ok := ret.Get(0).(func() (*model.SmartEnergyManagementPsDataType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (*model.SmartEnergyManagementPsDataType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() *model.SmartEnergyManagementPsDataType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() *model.SmartEnergyManagementPsDataType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.SmartEnergyManagementPsDataType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -81,8 +67,8 @@ func (_c *SmartEnergyManagementPsCommonInterface_GetData_Call) Run(run func()) * return _c } -func (_c *SmartEnergyManagementPsCommonInterface_GetData_Call) Return(smartEnergyManagementPsDataType *model.SmartEnergyManagementPsDataType, err error) *SmartEnergyManagementPsCommonInterface_GetData_Call { - _c.Call.Return(smartEnergyManagementPsDataType, err) +func (_c *SmartEnergyManagementPsCommonInterface_GetData_Call) Return(_a0 *model.SmartEnergyManagementPsDataType, _a1 error) *SmartEnergyManagementPsCommonInterface_GetData_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -90,3 +76,17 @@ func (_c *SmartEnergyManagementPsCommonInterface_GetData_Call) RunAndReturn(run _c.Call.Return(run) return _c } + +// NewSmartEnergyManagementPsCommonInterface creates a new instance of SmartEnergyManagementPsCommonInterface. 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 NewSmartEnergyManagementPsCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *SmartEnergyManagementPsCommonInterface { + mock := &SmartEnergyManagementPsCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/SmartEnergyManagementPsServerInterface.go b/mocks/SmartEnergyManagementPsServerInterface.go index 0bee8257..b7c3a323 100644 --- a/mocks/SmartEnergyManagementPsServerInterface.go +++ b/mocks/SmartEnergyManagementPsServerInterface.go @@ -1,12 +1,21 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks -import ( - mock "github.com/stretchr/testify/mock" -) +import mock "github.com/stretchr/testify/mock" + +// SmartEnergyManagementPsServerInterface is an autogenerated mock type for the SmartEnergyManagementPsServerInterface type +type SmartEnergyManagementPsServerInterface struct { + mock.Mock +} + +type SmartEnergyManagementPsServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *SmartEnergyManagementPsServerInterface) EXPECT() *SmartEnergyManagementPsServerInterface_Expecter { + return &SmartEnergyManagementPsServerInterface_Expecter{mock: &_m.Mock} +} // NewSmartEnergyManagementPsServerInterface creates a new instance of SmartEnergyManagementPsServerInterface. 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. @@ -21,16 +30,3 @@ func NewSmartEnergyManagementPsServerInterface(t interface { return mock } - -// SmartEnergyManagementPsServerInterface is an autogenerated mock type for the SmartEnergyManagementPsServerInterface type -type SmartEnergyManagementPsServerInterface struct { - mock.Mock -} - -type SmartEnergyManagementPsServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *SmartEnergyManagementPsServerInterface) EXPECT() *SmartEnergyManagementPsServerInterface_Expecter { - return &SmartEnergyManagementPsServerInterface_Expecter{mock: &_m.Mock} -} diff --git a/mocks/TimeSeriesClientInterface.go b/mocks/TimeSeriesClientInterface.go index 46dc1d37..782be79b 100644 --- a/mocks/TimeSeriesClientInterface.go +++ b/mocks/TimeSeriesClientInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewTimeSeriesClientInterface creates a new instance of TimeSeriesClientInterface. 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 NewTimeSeriesClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *TimeSeriesClientInterface { - mock := &TimeSeriesClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // TimeSeriesClientInterface is an autogenerated mock type for the TimeSeriesClientInterface type type TimeSeriesClientInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *TimeSeriesClientInterface) EXPECT() *TimeSeriesClientInterface_Expecte return &TimeSeriesClientInterface_Expecter{mock: &_m.Mock} } -// RequestConstraints provides a mock function for the type TimeSeriesClientInterface -func (_mock *TimeSeriesClientInterface) RequestConstraints(selector *model.TimeSeriesConstraintsListDataSelectorsType, elements *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestConstraints provides a mock function with given fields: selector, elements +func (_m *TimeSeriesClientInterface) RequestConstraints(selector *model.TimeSeriesConstraintsListDataSelectorsType, elements *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestConstraints") @@ -46,21 +30,23 @@ func (_mock *TimeSeriesClientInterface) RequestConstraints(selector *model.TimeS var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -78,35 +64,24 @@ func (_e *TimeSeriesClientInterface_Expecter) RequestConstraints(selector interf func (_c *TimeSeriesClientInterface_RequestConstraints_Call) Run(run func(selector *model.TimeSeriesConstraintsListDataSelectorsType, elements *model.TimeSeriesConstraintsDataElementsType)) *TimeSeriesClientInterface_RequestConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.TimeSeriesConstraintsListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.TimeSeriesConstraintsListDataSelectorsType) - } - var arg1 *model.TimeSeriesConstraintsDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.TimeSeriesConstraintsDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.TimeSeriesConstraintsListDataSelectorsType), args[1].(*model.TimeSeriesConstraintsDataElementsType)) }) return _c } -func (_c *TimeSeriesClientInterface_RequestConstraints_Call) Return(msgCounterType *model.MsgCounterType, err error) *TimeSeriesClientInterface_RequestConstraints_Call { - _c.Call.Return(msgCounterType, err) +func (_c *TimeSeriesClientInterface_RequestConstraints_Call) Return(_a0 *model.MsgCounterType, _a1 error) *TimeSeriesClientInterface_RequestConstraints_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *TimeSeriesClientInterface_RequestConstraints_Call) RunAndReturn(run func(selector *model.TimeSeriesConstraintsListDataSelectorsType, elements *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestConstraints_Call { +func (_c *TimeSeriesClientInterface_RequestConstraints_Call) RunAndReturn(run func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestConstraints_Call { _c.Call.Return(run) return _c } -// RequestData provides a mock function for the type TimeSeriesClientInterface -func (_mock *TimeSeriesClientInterface) RequestData(selector *model.TimeSeriesListDataSelectorsType, elements *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestData provides a mock function with given fields: selector, elements +func (_m *TimeSeriesClientInterface) RequestData(selector *model.TimeSeriesListDataSelectorsType, elements *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestData") @@ -114,21 +89,23 @@ func (_mock *TimeSeriesClientInterface) RequestData(selector *model.TimeSeriesLi var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -146,35 +123,24 @@ func (_e *TimeSeriesClientInterface_Expecter) RequestData(selector interface{}, func (_c *TimeSeriesClientInterface_RequestData_Call) Run(run func(selector *model.TimeSeriesListDataSelectorsType, elements *model.TimeSeriesDataElementsType)) *TimeSeriesClientInterface_RequestData_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.TimeSeriesListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.TimeSeriesListDataSelectorsType) - } - var arg1 *model.TimeSeriesDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.TimeSeriesDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.TimeSeriesListDataSelectorsType), args[1].(*model.TimeSeriesDataElementsType)) }) return _c } -func (_c *TimeSeriesClientInterface_RequestData_Call) Return(msgCounterType *model.MsgCounterType, err error) *TimeSeriesClientInterface_RequestData_Call { - _c.Call.Return(msgCounterType, err) +func (_c *TimeSeriesClientInterface_RequestData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *TimeSeriesClientInterface_RequestData_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *TimeSeriesClientInterface_RequestData_Call) RunAndReturn(run func(selector *model.TimeSeriesListDataSelectorsType, elements *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestData_Call { +func (_c *TimeSeriesClientInterface_RequestData_Call) RunAndReturn(run func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestData_Call { _c.Call.Return(run) return _c } -// RequestDescriptions provides a mock function for the type TimeSeriesClientInterface -func (_mock *TimeSeriesClientInterface) RequestDescriptions(selector *model.TimeSeriesDescriptionListDataSelectorsType, elements *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _mock.Called(selector, elements) +// RequestDescriptions provides a mock function with given fields: selector, elements +func (_m *TimeSeriesClientInterface) RequestDescriptions(selector *model.TimeSeriesDescriptionListDataSelectorsType, elements *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _m.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestDescriptions") @@ -182,21 +148,23 @@ func (_mock *TimeSeriesClientInterface) RequestDescriptions(selector *model.Time var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return rf(selector, elements) } - if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = returnFunc(selector, elements) + if rf, ok := ret.Get(0).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = rf(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) error); ok { - r1 = returnFunc(selector, elements) + + if rf, ok := ret.Get(1).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) error); ok { + r1 = rf(selector, elements) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -214,35 +182,24 @@ func (_e *TimeSeriesClientInterface_Expecter) RequestDescriptions(selector inter func (_c *TimeSeriesClientInterface_RequestDescriptions_Call) Run(run func(selector *model.TimeSeriesDescriptionListDataSelectorsType, elements *model.TimeSeriesDescriptionDataElementsType)) *TimeSeriesClientInterface_RequestDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 *model.TimeSeriesDescriptionListDataSelectorsType - if args[0] != nil { - arg0 = args[0].(*model.TimeSeriesDescriptionListDataSelectorsType) - } - var arg1 *model.TimeSeriesDescriptionDataElementsType - if args[1] != nil { - arg1 = args[1].(*model.TimeSeriesDescriptionDataElementsType) - } - run( - arg0, - arg1, - ) + run(args[0].(*model.TimeSeriesDescriptionListDataSelectorsType), args[1].(*model.TimeSeriesDescriptionDataElementsType)) }) return _c } -func (_c *TimeSeriesClientInterface_RequestDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *TimeSeriesClientInterface_RequestDescriptions_Call { - _c.Call.Return(msgCounterType, err) +func (_c *TimeSeriesClientInterface_RequestDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *TimeSeriesClientInterface_RequestDescriptions_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *TimeSeriesClientInterface_RequestDescriptions_Call) RunAndReturn(run func(selector *model.TimeSeriesDescriptionListDataSelectorsType, elements *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestDescriptions_Call { +func (_c *TimeSeriesClientInterface_RequestDescriptions_Call) RunAndReturn(run func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestDescriptions_Call { _c.Call.Return(run) return _c } -// WriteData provides a mock function for the type TimeSeriesClientInterface -func (_mock *TimeSeriesClientInterface) WriteData(data []model.TimeSeriesDataType) (*model.MsgCounterType, error) { - ret := _mock.Called(data) +// WriteData provides a mock function with given fields: data +func (_m *TimeSeriesClientInterface) WriteData(data []model.TimeSeriesDataType) (*model.MsgCounterType, error) { + ret := _m.Called(data) if len(ret) == 0 { panic("no return value specified for WriteData") @@ -250,21 +207,23 @@ func (_mock *TimeSeriesClientInterface) WriteData(data []model.TimeSeriesDataTyp var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func([]model.TimeSeriesDataType) (*model.MsgCounterType, error)); ok { - return returnFunc(data) + if rf, ok := ret.Get(0).(func([]model.TimeSeriesDataType) (*model.MsgCounterType, error)); ok { + return rf(data) } - if returnFunc, ok := ret.Get(0).(func([]model.TimeSeriesDataType) *model.MsgCounterType); ok { - r0 = returnFunc(data) + if rf, ok := ret.Get(0).(func([]model.TimeSeriesDataType) *model.MsgCounterType); ok { + r0 = rf(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func([]model.TimeSeriesDataType) error); ok { - r1 = returnFunc(data) + + if rf, ok := ret.Get(1).(func([]model.TimeSeriesDataType) error); ok { + r1 = rf(data) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -281,23 +240,31 @@ func (_e *TimeSeriesClientInterface_Expecter) WriteData(data interface{}) *TimeS func (_c *TimeSeriesClientInterface_WriteData_Call) Run(run func(data []model.TimeSeriesDataType)) *TimeSeriesClientInterface_WriteData_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []model.TimeSeriesDataType - if args[0] != nil { - arg0 = args[0].([]model.TimeSeriesDataType) - } - run( - arg0, - ) + run(args[0].([]model.TimeSeriesDataType)) }) return _c } -func (_c *TimeSeriesClientInterface_WriteData_Call) Return(msgCounterType *model.MsgCounterType, err error) *TimeSeriesClientInterface_WriteData_Call { - _c.Call.Return(msgCounterType, err) +func (_c *TimeSeriesClientInterface_WriteData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *TimeSeriesClientInterface_WriteData_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *TimeSeriesClientInterface_WriteData_Call) RunAndReturn(run func(data []model.TimeSeriesDataType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_WriteData_Call { +func (_c *TimeSeriesClientInterface_WriteData_Call) RunAndReturn(run func([]model.TimeSeriesDataType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_WriteData_Call { _c.Call.Return(run) return _c } + +// NewTimeSeriesClientInterface creates a new instance of TimeSeriesClientInterface. 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 NewTimeSeriesClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *TimeSeriesClientInterface { + mock := &TimeSeriesClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/TimeSeriesCommonInterface.go b/mocks/TimeSeriesCommonInterface.go index e816686e..11a84d43 100644 --- a/mocks/TimeSeriesCommonInterface.go +++ b/mocks/TimeSeriesCommonInterface.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/spine-go/model" + model "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) -// NewTimeSeriesCommonInterface creates a new instance of TimeSeriesCommonInterface. 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 NewTimeSeriesCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *TimeSeriesCommonInterface { - mock := &TimeSeriesCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // TimeSeriesCommonInterface is an autogenerated mock type for the TimeSeriesCommonInterface type type TimeSeriesCommonInterface struct { mock.Mock @@ -36,9 +20,9 @@ func (_m *TimeSeriesCommonInterface) EXPECT() *TimeSeriesCommonInterface_Expecte return &TimeSeriesCommonInterface_Expecter{mock: &_m.Mock} } -// GetConstraints provides a mock function for the type TimeSeriesCommonInterface -func (_mock *TimeSeriesCommonInterface) GetConstraints() ([]model.TimeSeriesConstraintsDataType, error) { - ret := _mock.Called() +// GetConstraints provides a mock function with no fields +func (_m *TimeSeriesCommonInterface) GetConstraints() ([]model.TimeSeriesConstraintsDataType, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for GetConstraints") @@ -46,21 +30,23 @@ func (_mock *TimeSeriesCommonInterface) GetConstraints() ([]model.TimeSeriesCons var r0 []model.TimeSeriesConstraintsDataType var r1 error - if returnFunc, ok := ret.Get(0).(func() ([]model.TimeSeriesConstraintsDataType, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() ([]model.TimeSeriesConstraintsDataType, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() []model.TimeSeriesConstraintsDataType); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() []model.TimeSeriesConstraintsDataType); ok { + r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.TimeSeriesConstraintsDataType) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -81,8 +67,8 @@ func (_c *TimeSeriesCommonInterface_GetConstraints_Call) Run(run func()) *TimeSe return _c } -func (_c *TimeSeriesCommonInterface_GetConstraints_Call) Return(timeSeriesConstraintsDataTypes []model.TimeSeriesConstraintsDataType, err error) *TimeSeriesCommonInterface_GetConstraints_Call { - _c.Call.Return(timeSeriesConstraintsDataTypes, err) +func (_c *TimeSeriesCommonInterface_GetConstraints_Call) Return(_a0 []model.TimeSeriesConstraintsDataType, _a1 error) *TimeSeriesCommonInterface_GetConstraints_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -91,9 +77,9 @@ func (_c *TimeSeriesCommonInterface_GetConstraints_Call) RunAndReturn(run func() return _c } -// GetDataForFilter provides a mock function for the type TimeSeriesCommonInterface -func (_mock *TimeSeriesCommonInterface) GetDataForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error) { - ret := _mock.Called(filter) +// GetDataForFilter provides a mock function with given fields: filter +func (_m *TimeSeriesCommonInterface) GetDataForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDataForFilter") @@ -101,21 +87,23 @@ func (_mock *TimeSeriesCommonInterface) GetDataForFilter(filter model.TimeSeries var r0 []model.TimeSeriesDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) []model.TimeSeriesDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) []model.TimeSeriesDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.TimeSeriesDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.TimeSeriesDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.TimeSeriesDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -132,30 +120,24 @@ func (_e *TimeSeriesCommonInterface_Expecter) GetDataForFilter(filter interface{ func (_c *TimeSeriesCommonInterface_GetDataForFilter_Call) Run(run func(filter model.TimeSeriesDescriptionDataType)) *TimeSeriesCommonInterface_GetDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.TimeSeriesDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.TimeSeriesDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.TimeSeriesDescriptionDataType)) }) return _c } -func (_c *TimeSeriesCommonInterface_GetDataForFilter_Call) Return(timeSeriesDataTypes []model.TimeSeriesDataType, err error) *TimeSeriesCommonInterface_GetDataForFilter_Call { - _c.Call.Return(timeSeriesDataTypes, err) +func (_c *TimeSeriesCommonInterface_GetDataForFilter_Call) Return(_a0 []model.TimeSeriesDataType, _a1 error) *TimeSeriesCommonInterface_GetDataForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *TimeSeriesCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)) *TimeSeriesCommonInterface_GetDataForFilter_Call { +func (_c *TimeSeriesCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)) *TimeSeriesCommonInterface_GetDataForFilter_Call { _c.Call.Return(run) return _c } -// GetDescriptionsForFilter provides a mock function for the type TimeSeriesCommonInterface -func (_mock *TimeSeriesCommonInterface) GetDescriptionsForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error) { - ret := _mock.Called(filter) +// GetDescriptionsForFilter provides a mock function with given fields: filter +func (_m *TimeSeriesCommonInterface) GetDescriptionsForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error) { + ret := _m.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionsForFilter") @@ -163,21 +145,23 @@ func (_mock *TimeSeriesCommonInterface) GetDescriptionsForFilter(filter model.Ti var r0 []model.TimeSeriesDescriptionDataType var r1 error - if returnFunc, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)); ok { - return returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)); ok { + return rf(filter) } - if returnFunc, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) []model.TimeSeriesDescriptionDataType); ok { - r0 = returnFunc(filter) + if rf, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) []model.TimeSeriesDescriptionDataType); ok { + r0 = rf(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.TimeSeriesDescriptionDataType) } } - if returnFunc, ok := ret.Get(1).(func(model.TimeSeriesDescriptionDataType) error); ok { - r1 = returnFunc(filter) + + if rf, ok := ret.Get(1).(func(model.TimeSeriesDescriptionDataType) error); ok { + r1 = rf(filter) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -194,23 +178,31 @@ func (_e *TimeSeriesCommonInterface_Expecter) GetDescriptionsForFilter(filter in func (_c *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call) Run(run func(filter model.TimeSeriesDescriptionDataType)) *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.TimeSeriesDescriptionDataType - if args[0] != nil { - arg0 = args[0].(model.TimeSeriesDescriptionDataType) - } - run( - arg0, - ) + run(args[0].(model.TimeSeriesDescriptionDataType)) }) return _c } -func (_c *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call) Return(timeSeriesDescriptionDataTypes []model.TimeSeriesDescriptionDataType, err error) *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call { - _c.Call.Return(timeSeriesDescriptionDataTypes, err) +func (_c *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call) Return(_a0 []model.TimeSeriesDescriptionDataType, _a1 error) *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)) *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call { +func (_c *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)) *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Return(run) return _c } + +// NewTimeSeriesCommonInterface creates a new instance of TimeSeriesCommonInterface. 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 NewTimeSeriesCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *TimeSeriesCommonInterface { + mock := &TimeSeriesCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/TimeSeriesServerInterface.go b/mocks/TimeSeriesServerInterface.go index 78248483..13623fff 100644 --- a/mocks/TimeSeriesServerInterface.go +++ b/mocks/TimeSeriesServerInterface.go @@ -1,12 +1,21 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks -import ( - mock "github.com/stretchr/testify/mock" -) +import mock "github.com/stretchr/testify/mock" + +// TimeSeriesServerInterface is an autogenerated mock type for the TimeSeriesServerInterface type +type TimeSeriesServerInterface struct { + mock.Mock +} + +type TimeSeriesServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *TimeSeriesServerInterface) EXPECT() *TimeSeriesServerInterface_Expecter { + return &TimeSeriesServerInterface_Expecter{mock: &_m.Mock} +} // NewTimeSeriesServerInterface creates a new instance of TimeSeriesServerInterface. 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. @@ -21,16 +30,3 @@ func NewTimeSeriesServerInterface(t interface { return mock } - -// TimeSeriesServerInterface is an autogenerated mock type for the TimeSeriesServerInterface type -type TimeSeriesServerInterface struct { - mock.Mock -} - -type TimeSeriesServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *TimeSeriesServerInterface) EXPECT() *TimeSeriesServerInterface_Expecter { - return &TimeSeriesServerInterface_Expecter{mock: &_m.Mock} -} diff --git a/mocks/UseCaseBaseInterface.go b/mocks/UseCaseBaseInterface.go index e454ded4..bc669948 100644 --- a/mocks/UseCaseBaseInterface.go +++ b/mocks/UseCaseBaseInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api0 "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/api" + api "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) - -// NewUseCaseBaseInterface creates a new instance of UseCaseBaseInterface. 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 NewUseCaseBaseInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *UseCaseBaseInterface { - mock := &UseCaseBaseInterface{} - mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // UseCaseBaseInterface is an autogenerated mock type for the UseCaseBaseInterface type type UseCaseBaseInterface struct { @@ -37,10 +22,9 @@ func (_m *UseCaseBaseInterface) EXPECT() *UseCaseBaseInterface_Expecter { return &UseCaseBaseInterface_Expecter{mock: &_m.Mock} } -// AddUseCase provides a mock function for the type UseCaseBaseInterface -func (_mock *UseCaseBaseInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *UseCaseBaseInterface) AddUseCase() { + _m.Called() } // UseCaseBaseInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -70,22 +54,23 @@ func (_c *UseCaseBaseInterface_AddUseCase_Call) RunAndReturn(run func()) *UseCas return _c } -// AvailableScenariosForEntity provides a mock function for the type UseCaseBaseInterface -func (_mock *UseCaseBaseInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *UseCaseBaseInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -95,48 +80,43 @@ type UseCaseBaseInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *UseCaseBaseInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { return &UseCaseBaseInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { +func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { +func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type UseCaseBaseInterface -func (_mock *UseCaseBaseInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *UseCaseBaseInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -146,48 +126,43 @@ type UseCaseBaseInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *UseCaseBaseInterface_Expecter) IsCompatibleEntityType(entity interface{}) *UseCaseBaseInterface_IsCompatibleEntityType_Call { return &UseCaseBaseInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *UseCaseBaseInterface_IsCompatibleEntityType_Call { +func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *UseCaseBaseInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) Return(b bool) *UseCaseBaseInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *UseCaseBaseInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *UseCaseBaseInterface_IsCompatibleEntityType_Call { +func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *UseCaseBaseInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type UseCaseBaseInterface -func (_mock *UseCaseBaseInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *UseCaseBaseInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -197,56 +172,46 @@ type UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *UseCaseBaseInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { return &UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { +func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { +func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type UseCaseBaseInterface -func (_mock *UseCaseBaseInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *UseCaseBaseInterface) RemoteEntitiesScenarios() []api.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api0.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []api.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []api.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.RemoteEntityScenarios) + r0 = ret.Get(0).([]api.RemoteEntityScenarios) } } + return r0 } @@ -267,20 +232,19 @@ func (_c *UseCaseBaseInterface_RemoteEntitiesScenarios_Call) Run(run func()) *Us return _c } -func (_c *UseCaseBaseInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *UseCaseBaseInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *UseCaseBaseInterface_RemoteEntitiesScenarios_Call) Return(_a0 []api.RemoteEntityScenarios) *UseCaseBaseInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *UseCaseBaseInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *UseCaseBaseInterface_RemoteEntitiesScenarios_Call { +func (_c *UseCaseBaseInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api.RemoteEntityScenarios) *UseCaseBaseInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type UseCaseBaseInterface -func (_mock *UseCaseBaseInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *UseCaseBaseInterface) RemoveUseCase() { + _m.Called() } // UseCaseBaseInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -310,10 +274,9 @@ func (_c *UseCaseBaseInterface_RemoveUseCase_Call) RunAndReturn(run func()) *Use return _c } -// UpdateUseCaseAvailability provides a mock function for the type UseCaseBaseInterface -func (_mock *UseCaseBaseInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *UseCaseBaseInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // UseCaseBaseInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -329,13 +292,7 @@ func (_e *UseCaseBaseInterface_Expecter) UpdateUseCaseAvailability(available int func (_c *UseCaseBaseInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *UseCaseBaseInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -345,7 +302,21 @@ func (_c *UseCaseBaseInterface_UpdateUseCaseAvailability_Call) Return() *UseCase return _c } -func (_c *UseCaseBaseInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *UseCaseBaseInterface_UpdateUseCaseAvailability_Call { +func (_c *UseCaseBaseInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *UseCaseBaseInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } + +// NewUseCaseBaseInterface creates a new instance of UseCaseBaseInterface. 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 NewUseCaseBaseInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *UseCaseBaseInterface { + mock := &UseCaseBaseInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/UseCaseInterface.go b/mocks/UseCaseInterface.go index 308ef381..3f52ca9f 100644 --- a/mocks/UseCaseInterface.go +++ b/mocks/UseCaseInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api0 "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/api" + api "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) - -// NewUseCaseInterface creates a new instance of UseCaseInterface. 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 NewUseCaseInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *UseCaseInterface { - mock := &UseCaseInterface{} - mock.Mock.Test(t) - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // UseCaseInterface is an autogenerated mock type for the UseCaseInterface type type UseCaseInterface struct { @@ -37,20 +22,21 @@ func (_m *UseCaseInterface) EXPECT() *UseCaseInterface_Expecter { return &UseCaseInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type UseCaseInterface -func (_mock *UseCaseInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *UseCaseInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -71,8 +57,8 @@ func (_c *UseCaseInterface_AddFeatures_Call) Run(run func()) *UseCaseInterface_A return _c } -func (_c *UseCaseInterface_AddFeatures_Call) Return(err error) *UseCaseInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *UseCaseInterface_AddFeatures_Call) Return(_a0 error) *UseCaseInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -81,10 +67,9 @@ func (_c *UseCaseInterface_AddFeatures_Call) RunAndReturn(run func() error) *Use return _c } -// AddUseCase provides a mock function for the type UseCaseInterface -func (_mock *UseCaseInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *UseCaseInterface) AddUseCase() { + _m.Called() } // UseCaseInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -114,22 +99,23 @@ func (_c *UseCaseInterface_AddUseCase_Call) RunAndReturn(run func()) *UseCaseInt return _c } -// AvailableScenariosForEntity provides a mock function for the type UseCaseInterface -func (_mock *UseCaseInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *UseCaseInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -139,48 +125,43 @@ type UseCaseInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *UseCaseInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *UseCaseInterface_AvailableScenariosForEntity_Call { return &UseCaseInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *UseCaseInterface_AvailableScenariosForEntity_Call { +func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *UseCaseInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *UseCaseInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *UseCaseInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *UseCaseInterface_AvailableScenariosForEntity_Call { +func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *UseCaseInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type UseCaseInterface -func (_mock *UseCaseInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *UseCaseInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -190,48 +171,43 @@ type UseCaseInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *UseCaseInterface_Expecter) IsCompatibleEntityType(entity interface{}) *UseCaseInterface_IsCompatibleEntityType_Call { return &UseCaseInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *UseCaseInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *UseCaseInterface_IsCompatibleEntityType_Call { +func (_c *UseCaseInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *UseCaseInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *UseCaseInterface_IsCompatibleEntityType_Call) Return(b bool) *UseCaseInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *UseCaseInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *UseCaseInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *UseCaseInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *UseCaseInterface_IsCompatibleEntityType_Call { +func (_c *UseCaseInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *UseCaseInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type UseCaseInterface -func (_mock *UseCaseInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *UseCaseInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -241,56 +217,46 @@ type UseCaseInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *UseCaseInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { return &UseCaseInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { +func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { +func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type UseCaseInterface -func (_mock *UseCaseInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *UseCaseInterface) RemoteEntitiesScenarios() []api.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api0.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []api.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []api.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.RemoteEntityScenarios) + r0 = ret.Get(0).([]api.RemoteEntityScenarios) } } + return r0 } @@ -311,20 +277,19 @@ func (_c *UseCaseInterface_RemoteEntitiesScenarios_Call) Run(run func()) *UseCas return _c } -func (_c *UseCaseInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *UseCaseInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *UseCaseInterface_RemoteEntitiesScenarios_Call) Return(_a0 []api.RemoteEntityScenarios) *UseCaseInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *UseCaseInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *UseCaseInterface_RemoteEntitiesScenarios_Call { +func (_c *UseCaseInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api.RemoteEntityScenarios) *UseCaseInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type UseCaseInterface -func (_mock *UseCaseInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *UseCaseInterface) RemoveUseCase() { + _m.Called() } // UseCaseInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -354,10 +319,9 @@ func (_c *UseCaseInterface_RemoveUseCase_Call) RunAndReturn(run func()) *UseCase return _c } -// UpdateUseCaseAvailability provides a mock function for the type UseCaseInterface -func (_mock *UseCaseInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *UseCaseInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // UseCaseInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -373,13 +337,7 @@ func (_e *UseCaseInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *UseCaseInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *UseCaseInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -389,7 +347,21 @@ func (_c *UseCaseInterface_UpdateUseCaseAvailability_Call) Return() *UseCaseInte return _c } -func (_c *UseCaseInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *UseCaseInterface_UpdateUseCaseAvailability_Call { +func (_c *UseCaseInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *UseCaseInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } + +// NewUseCaseInterface creates a new instance of UseCaseInterface. 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 NewUseCaseInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *UseCaseInterface { + mock := &UseCaseInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/service/service.go b/service/service.go index 97b53dfd..e41a1eed 100644 --- a/service/service.go +++ b/service/service.go @@ -215,8 +215,7 @@ func (s *Service) IsRunning() bool { func (s *Service) AddUseCase(useCase api.UseCaseInterface) error { s.usecases = append(s.usecases, useCase) - err := useCase.AddFeatures() - if err != nil { + if err := useCase.AddFeatures(); err != nil { return err } useCase.AddUseCase() diff --git a/service/service_test.go b/service/service_test.go index 9edd6b58..08546503 100644 --- a/service/service_test.go +++ b/service/service_test.go @@ -70,6 +70,14 @@ func (s *ServiceSuite) Test_AddUseCase() { s.sut.AddUseCase(ucMock) } +func (s *ServiceSuite) Test_AddUseCase_Error() { + ucMock := mocks.NewUseCaseInterface(s.T()) + ucMock.EXPECT().AddFeatures().Return(assert.AnError).Once() + + err := s.sut.AddUseCase(ucMock) + assert.Equal(s.T(), assert.AnError, err) +} + func (s *ServiceSuite) Test_EEBUSHandler() { testSki := "test" diff --git a/usecases/api/mu_mpc.go b/usecases/api/mu_mpc.go index 80bc3f21..26baa548 100644 --- a/usecases/api/mu_mpc.go +++ b/usecases/api/mu_mpc.go @@ -27,7 +27,7 @@ type MuMPCInterface interface { // possible errors: // - ErrMissingData if the id is not available // - and others - PowerPerPhase() ([]float64, error) + PowerPerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) // Scenario 2 @@ -59,7 +59,7 @@ type MuMPCInterface interface { // possible errors: // - ErrMissingData if the id is not available // - and others - CurrentPerPhase() ([]float64, error) + CurrentPerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) // Scenario 4 @@ -68,7 +68,7 @@ type MuMPCInterface interface { // possible errors: // - ErrMissingData if the id is not available // - and others - VoltagePerPhase() ([]float64, error) + VoltagePerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) // Scenario 5 @@ -187,10 +187,10 @@ type MuMPCInterface interface { // The valueState shall be set if it differs from the normal valueState otherwise it can be nil UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData - // use UpdateDataVoltagePhaseCToA in Update to set the phase specific voltage details + // use UpdateDataVoltagePhaseAToC in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData + UpdateDataVoltagePhaseAToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) UpdateMeasurementData // Scenario 5 diff --git a/usecases/mocks/CemCEVCInterface.go b/usecases/mocks/CemCEVCInterface.go index b317cfa0..33ecd02f 100644 --- a/usecases/mocks/CemCEVCInterface.go +++ b/usecases/mocks/CemCEVCInterface.go @@ -1,29 +1,15 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api1 "github.com/enbility/eebus-go/api" - api0 "github.com/enbility/eebus-go/usecases/api" - "github.com/enbility/spine-go/api" - mock "github.com/stretchr/testify/mock" -) + eebus_goapi "github.com/enbility/eebus-go/api" + api "github.com/enbility/eebus-go/usecases/api" -// NewCemCEVCInterface creates a new instance of CemCEVCInterface. 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 NewCemCEVCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemCEVCInterface { - mock := &CemCEVCInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) + mock "github.com/stretchr/testify/mock" - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // CemCEVCInterface is an autogenerated mock type for the CemCEVCInterface type type CemCEVCInterface struct { @@ -38,20 +24,21 @@ func (_m *CemCEVCInterface) EXPECT() *CemCEVCInterface_Expecter { return &CemCEVCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *CemCEVCInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -72,8 +59,8 @@ func (_c *CemCEVCInterface_AddFeatures_Call) Run(run func()) *CemCEVCInterface_A return _c } -func (_c *CemCEVCInterface_AddFeatures_Call) Return(err error) *CemCEVCInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *CemCEVCInterface_AddFeatures_Call) Return(_a0 error) *CemCEVCInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -82,10 +69,9 @@ func (_c *CemCEVCInterface_AddFeatures_Call) RunAndReturn(run func() error) *Cem return _c } -// AddUseCase provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *CemCEVCInterface) AddUseCase() { + _m.Called() } // CemCEVCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -115,22 +101,23 @@ func (_c *CemCEVCInterface_AddUseCase_Call) RunAndReturn(run func()) *CemCEVCInt return _c } -// AvailableScenariosForEntity provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *CemCEVCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -140,57 +127,53 @@ type CemCEVCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemCEVCInterface_AvailableScenariosForEntity_Call { return &CemCEVCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_AvailableScenariosForEntity_Call { +func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemCEVCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemCEVCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemCEVCInterface_AvailableScenariosForEntity_Call { +func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemCEVCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// ChargePlan provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) ChargePlan(entity api.EntityRemoteInterface) (api0.ChargePlan, error) { - ret := _mock.Called(entity) +// ChargePlan provides a mock function with given fields: entity +func (_m *CemCEVCInterface) ChargePlan(entity spine_goapi.EntityRemoteInterface) (api.ChargePlan, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for ChargePlan") } - var r0 api0.ChargePlan + var r0 api.ChargePlan var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.ChargePlan, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.ChargePlan, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.ChargePlan); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.ChargePlan); ok { + r0 = rf(entity) } else { - r0 = ret.Get(0).(api0.ChargePlan) + r0 = ret.Get(0).(api.ChargePlan) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -200,59 +183,55 @@ type CemCEVCInterface_ChargePlan_Call struct { } // ChargePlan is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) ChargePlan(entity interface{}) *CemCEVCInterface_ChargePlan_Call { return &CemCEVCInterface_ChargePlan_Call{Call: _e.mock.On("ChargePlan", entity)} } -func (_c *CemCEVCInterface_ChargePlan_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_ChargePlan_Call { +func (_c *CemCEVCInterface_ChargePlan_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_ChargePlan_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemCEVCInterface_ChargePlan_Call) Return(chargePlan api0.ChargePlan, err error) *CemCEVCInterface_ChargePlan_Call { - _c.Call.Return(chargePlan, err) +func (_c *CemCEVCInterface_ChargePlan_Call) Return(_a0 api.ChargePlan, _a1 error) *CemCEVCInterface_ChargePlan_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemCEVCInterface_ChargePlan_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.ChargePlan, error)) *CemCEVCInterface_ChargePlan_Call { +func (_c *CemCEVCInterface_ChargePlan_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.ChargePlan, error)) *CemCEVCInterface_ChargePlan_Call { _c.Call.Return(run) return _c } -// ChargePlanConstraints provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) ChargePlanConstraints(entity api.EntityRemoteInterface) ([]api0.DurationSlotValue, error) { - ret := _mock.Called(entity) +// ChargePlanConstraints provides a mock function with given fields: entity +func (_m *CemCEVCInterface) ChargePlanConstraints(entity spine_goapi.EntityRemoteInterface) ([]api.DurationSlotValue, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for ChargePlanConstraints") } - var r0 []api0.DurationSlotValue + var r0 []api.DurationSlotValue var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]api0.DurationSlotValue, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]api.DurationSlotValue, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []api0.DurationSlotValue); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []api.DurationSlotValue); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.DurationSlotValue) + r0 = ret.Get(0).([]api.DurationSlotValue) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -262,48 +241,43 @@ type CemCEVCInterface_ChargePlanConstraints_Call struct { } // ChargePlanConstraints is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) ChargePlanConstraints(entity interface{}) *CemCEVCInterface_ChargePlanConstraints_Call { return &CemCEVCInterface_ChargePlanConstraints_Call{Call: _e.mock.On("ChargePlanConstraints", entity)} } -func (_c *CemCEVCInterface_ChargePlanConstraints_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_ChargePlanConstraints_Call { +func (_c *CemCEVCInterface_ChargePlanConstraints_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_ChargePlanConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemCEVCInterface_ChargePlanConstraints_Call) Return(durationSlotValues []api0.DurationSlotValue, err error) *CemCEVCInterface_ChargePlanConstraints_Call { - _c.Call.Return(durationSlotValues, err) +func (_c *CemCEVCInterface_ChargePlanConstraints_Call) Return(_a0 []api.DurationSlotValue, _a1 error) *CemCEVCInterface_ChargePlanConstraints_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemCEVCInterface_ChargePlanConstraints_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]api0.DurationSlotValue, error)) *CemCEVCInterface_ChargePlanConstraints_Call { +func (_c *CemCEVCInterface_ChargePlanConstraints_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]api.DurationSlotValue, error)) *CemCEVCInterface_ChargePlanConstraints_Call { _c.Call.Return(run) return _c } -// ChargeStrategy provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) ChargeStrategy(remoteEntity api.EntityRemoteInterface) api0.EVChargeStrategyType { - ret := _mock.Called(remoteEntity) +// ChargeStrategy provides a mock function with given fields: remoteEntity +func (_m *CemCEVCInterface) ChargeStrategy(remoteEntity spine_goapi.EntityRemoteInterface) api.EVChargeStrategyType { + ret := _m.Called(remoteEntity) if len(ret) == 0 { panic("no return value specified for ChargeStrategy") } - var r0 api0.EVChargeStrategyType - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.EVChargeStrategyType); ok { - r0 = returnFunc(remoteEntity) + var r0 api.EVChargeStrategyType + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.EVChargeStrategyType); ok { + r0 = rf(remoteEntity) } else { - r0 = ret.Get(0).(api0.EVChargeStrategyType) + r0 = ret.Get(0).(api.EVChargeStrategyType) } + return r0 } @@ -313,57 +287,53 @@ type CemCEVCInterface_ChargeStrategy_Call struct { } // ChargeStrategy is a helper method to define mock.On call -// - remoteEntity api.EntityRemoteInterface +// - remoteEntity spine_goapi.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) ChargeStrategy(remoteEntity interface{}) *CemCEVCInterface_ChargeStrategy_Call { return &CemCEVCInterface_ChargeStrategy_Call{Call: _e.mock.On("ChargeStrategy", remoteEntity)} } -func (_c *CemCEVCInterface_ChargeStrategy_Call) Run(run func(remoteEntity api.EntityRemoteInterface)) *CemCEVCInterface_ChargeStrategy_Call { +func (_c *CemCEVCInterface_ChargeStrategy_Call) Run(run func(remoteEntity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_ChargeStrategy_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemCEVCInterface_ChargeStrategy_Call) Return(eVChargeStrategyType api0.EVChargeStrategyType) *CemCEVCInterface_ChargeStrategy_Call { - _c.Call.Return(eVChargeStrategyType) +func (_c *CemCEVCInterface_ChargeStrategy_Call) Return(_a0 api.EVChargeStrategyType) *CemCEVCInterface_ChargeStrategy_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemCEVCInterface_ChargeStrategy_Call) RunAndReturn(run func(remoteEntity api.EntityRemoteInterface) api0.EVChargeStrategyType) *CemCEVCInterface_ChargeStrategy_Call { +func (_c *CemCEVCInterface_ChargeStrategy_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) api.EVChargeStrategyType) *CemCEVCInterface_ChargeStrategy_Call { _c.Call.Return(run) return _c } -// EnergyDemand provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) EnergyDemand(remoteEntity api.EntityRemoteInterface) (api0.Demand, error) { - ret := _mock.Called(remoteEntity) +// EnergyDemand provides a mock function with given fields: remoteEntity +func (_m *CemCEVCInterface) EnergyDemand(remoteEntity spine_goapi.EntityRemoteInterface) (api.Demand, error) { + ret := _m.Called(remoteEntity) if len(ret) == 0 { panic("no return value specified for EnergyDemand") } - var r0 api0.Demand + var r0 api.Demand var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.Demand, error)); ok { - return returnFunc(remoteEntity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.Demand, error)); ok { + return rf(remoteEntity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.Demand); ok { - r0 = returnFunc(remoteEntity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.Demand); ok { + r0 = rf(remoteEntity) } else { - r0 = ret.Get(0).(api0.Demand) + r0 = ret.Get(0).(api.Demand) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(remoteEntity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(remoteEntity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -373,57 +343,53 @@ type CemCEVCInterface_EnergyDemand_Call struct { } // EnergyDemand is a helper method to define mock.On call -// - remoteEntity api.EntityRemoteInterface +// - remoteEntity spine_goapi.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) EnergyDemand(remoteEntity interface{}) *CemCEVCInterface_EnergyDemand_Call { return &CemCEVCInterface_EnergyDemand_Call{Call: _e.mock.On("EnergyDemand", remoteEntity)} } -func (_c *CemCEVCInterface_EnergyDemand_Call) Run(run func(remoteEntity api.EntityRemoteInterface)) *CemCEVCInterface_EnergyDemand_Call { +func (_c *CemCEVCInterface_EnergyDemand_Call) Run(run func(remoteEntity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_EnergyDemand_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemCEVCInterface_EnergyDemand_Call) Return(demand api0.Demand, err error) *CemCEVCInterface_EnergyDemand_Call { - _c.Call.Return(demand, err) +func (_c *CemCEVCInterface_EnergyDemand_Call) Return(_a0 api.Demand, _a1 error) *CemCEVCInterface_EnergyDemand_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemCEVCInterface_EnergyDemand_Call) RunAndReturn(run func(remoteEntity api.EntityRemoteInterface) (api0.Demand, error)) *CemCEVCInterface_EnergyDemand_Call { +func (_c *CemCEVCInterface_EnergyDemand_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.Demand, error)) *CemCEVCInterface_EnergyDemand_Call { _c.Call.Return(run) return _c } -// IncentiveConstraints provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) IncentiveConstraints(entity api.EntityRemoteInterface) (api0.IncentiveSlotConstraints, error) { - ret := _mock.Called(entity) +// IncentiveConstraints provides a mock function with given fields: entity +func (_m *CemCEVCInterface) IncentiveConstraints(entity spine_goapi.EntityRemoteInterface) (api.IncentiveSlotConstraints, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IncentiveConstraints") } - var r0 api0.IncentiveSlotConstraints + var r0 api.IncentiveSlotConstraints var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.IncentiveSlotConstraints, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.IncentiveSlotConstraints, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.IncentiveSlotConstraints); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.IncentiveSlotConstraints); ok { + r0 = rf(entity) } else { - r0 = ret.Get(0).(api0.IncentiveSlotConstraints) + r0 = ret.Get(0).(api.IncentiveSlotConstraints) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -433,48 +399,43 @@ type CemCEVCInterface_IncentiveConstraints_Call struct { } // IncentiveConstraints is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) IncentiveConstraints(entity interface{}) *CemCEVCInterface_IncentiveConstraints_Call { return &CemCEVCInterface_IncentiveConstraints_Call{Call: _e.mock.On("IncentiveConstraints", entity)} } -func (_c *CemCEVCInterface_IncentiveConstraints_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_IncentiveConstraints_Call { +func (_c *CemCEVCInterface_IncentiveConstraints_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_IncentiveConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemCEVCInterface_IncentiveConstraints_Call) Return(incentiveSlotConstraints api0.IncentiveSlotConstraints, err error) *CemCEVCInterface_IncentiveConstraints_Call { - _c.Call.Return(incentiveSlotConstraints, err) +func (_c *CemCEVCInterface_IncentiveConstraints_Call) Return(_a0 api.IncentiveSlotConstraints, _a1 error) *CemCEVCInterface_IncentiveConstraints_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemCEVCInterface_IncentiveConstraints_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.IncentiveSlotConstraints, error)) *CemCEVCInterface_IncentiveConstraints_Call { +func (_c *CemCEVCInterface_IncentiveConstraints_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.IncentiveSlotConstraints, error)) *CemCEVCInterface_IncentiveConstraints_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *CemCEVCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -484,48 +445,43 @@ type CemCEVCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemCEVCInterface_IsCompatibleEntityType_Call { return &CemCEVCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_IsCompatibleEntityType_Call { +func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) Return(b bool) *CemCEVCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemCEVCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemCEVCInterface_IsCompatibleEntityType_Call { +func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemCEVCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *CemCEVCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -535,56 +491,46 @@ type CemCEVCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *CemCEVCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { return &CemCEVCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *CemCEVCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api1.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api1.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -605,20 +551,19 @@ func (_c *CemCEVCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemCEV return _c } -func (_c *CemCEVCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CemCEVCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *CemCEVCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemCEVCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemCEVCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CemCEVCInterface_RemoteEntitiesScenarios_Call { +func (_c *CemCEVCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemCEVCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *CemCEVCInterface) RemoveUseCase() { + _m.Called() } // CemCEVCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -648,20 +593,21 @@ func (_c *CemCEVCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemCEVC return _c } -// SetOperatingState provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) SetOperatingState(failureState bool) error { - ret := _mock.Called(failureState) +// SetOperatingState provides a mock function with given fields: failureState +func (_m *CemCEVCInterface) SetOperatingState(failureState bool) error { + ret := _m.Called(failureState) if len(ret) == 0 { panic("no return value specified for SetOperatingState") } var r0 error - if returnFunc, ok := ret.Get(0).(func(bool) error); ok { - r0 = returnFunc(failureState) + if rf, ok := ret.Get(0).(func(bool) error); ok { + r0 = rf(failureState) } else { r0 = ret.Error(0) } + return r0 } @@ -678,31 +624,24 @@ func (_e *CemCEVCInterface_Expecter) SetOperatingState(failureState interface{}) func (_c *CemCEVCInterface_SetOperatingState_Call) Run(run func(failureState bool)) *CemCEVCInterface_SetOperatingState_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } -func (_c *CemCEVCInterface_SetOperatingState_Call) Return(err error) *CemCEVCInterface_SetOperatingState_Call { - _c.Call.Return(err) +func (_c *CemCEVCInterface_SetOperatingState_Call) Return(_a0 error) *CemCEVCInterface_SetOperatingState_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemCEVCInterface_SetOperatingState_Call) RunAndReturn(run func(failureState bool) error) *CemCEVCInterface_SetOperatingState_Call { +func (_c *CemCEVCInterface_SetOperatingState_Call) RunAndReturn(run func(bool) error) *CemCEVCInterface_SetOperatingState_Call { _c.Call.Return(run) return _c } -// StartHeartbeat provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) StartHeartbeat() { - _mock.Called() - return +// StartHeartbeat provides a mock function with no fields +func (_m *CemCEVCInterface) StartHeartbeat() { + _m.Called() } // CemCEVCInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -732,10 +671,9 @@ func (_c *CemCEVCInterface_StartHeartbeat_Call) RunAndReturn(run func()) *CemCEV return _c } -// StopHeartbeat provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) StopHeartbeat() { - _mock.Called() - return +// StopHeartbeat provides a mock function with no fields +func (_m *CemCEVCInterface) StopHeartbeat() { + _m.Called() } // CemCEVCInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -765,29 +703,31 @@ func (_c *CemCEVCInterface_StopHeartbeat_Call) RunAndReturn(run func()) *CemCEVC return _c } -// TimeSlotConstraints provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) TimeSlotConstraints(entity api.EntityRemoteInterface) (api0.TimeSlotConstraints, error) { - ret := _mock.Called(entity) +// TimeSlotConstraints provides a mock function with given fields: entity +func (_m *CemCEVCInterface) TimeSlotConstraints(entity spine_goapi.EntityRemoteInterface) (api.TimeSlotConstraints, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for TimeSlotConstraints") } - var r0 api0.TimeSlotConstraints + var r0 api.TimeSlotConstraints var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.TimeSlotConstraints, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.TimeSlotConstraints, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.TimeSlotConstraints); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.TimeSlotConstraints); ok { + r0 = rf(entity) } else { - r0 = ret.Get(0).(api0.TimeSlotConstraints) + r0 = ret.Get(0).(api.TimeSlotConstraints) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -797,38 +737,31 @@ type CemCEVCInterface_TimeSlotConstraints_Call struct { } // TimeSlotConstraints is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) TimeSlotConstraints(entity interface{}) *CemCEVCInterface_TimeSlotConstraints_Call { return &CemCEVCInterface_TimeSlotConstraints_Call{Call: _e.mock.On("TimeSlotConstraints", entity)} } -func (_c *CemCEVCInterface_TimeSlotConstraints_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_TimeSlotConstraints_Call { +func (_c *CemCEVCInterface_TimeSlotConstraints_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_TimeSlotConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemCEVCInterface_TimeSlotConstraints_Call) Return(timeSlotConstraints api0.TimeSlotConstraints, err error) *CemCEVCInterface_TimeSlotConstraints_Call { - _c.Call.Return(timeSlotConstraints, err) +func (_c *CemCEVCInterface_TimeSlotConstraints_Call) Return(_a0 api.TimeSlotConstraints, _a1 error) *CemCEVCInterface_TimeSlotConstraints_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemCEVCInterface_TimeSlotConstraints_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.TimeSlotConstraints, error)) *CemCEVCInterface_TimeSlotConstraints_Call { +func (_c *CemCEVCInterface_TimeSlotConstraints_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.TimeSlotConstraints, error)) *CemCEVCInterface_TimeSlotConstraints_Call { _c.Call.Return(run) return _c } -// UpdateUseCaseAvailability provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *CemCEVCInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // CemCEVCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -844,13 +777,7 @@ func (_e *CemCEVCInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *CemCEVCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemCEVCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -860,25 +787,26 @@ func (_c *CemCEVCInterface_UpdateUseCaseAvailability_Call) Return() *CemCEVCInte return _c } -func (_c *CemCEVCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemCEVCInterface_UpdateUseCaseAvailability_Call { +func (_c *CemCEVCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemCEVCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// WriteIncentiveTableDescriptions provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) WriteIncentiveTableDescriptions(entity api.EntityRemoteInterface, data []api0.IncentiveTariffDescription) error { - ret := _mock.Called(entity, data) +// WriteIncentiveTableDescriptions provides a mock function with given fields: entity, data +func (_m *CemCEVCInterface) WriteIncentiveTableDescriptions(entity spine_goapi.EntityRemoteInterface, data []api.IncentiveTariffDescription) error { + ret := _m.Called(entity, data) if len(ret) == 0 { panic("no return value specified for WriteIncentiveTableDescriptions") } var r0 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.IncentiveTariffDescription) error); ok { - r0 = returnFunc(entity, data) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.IncentiveTariffDescription) error); ok { + r0 = rf(entity, data) } else { r0 = ret.Error(0) } + return r0 } @@ -888,54 +816,44 @@ type CemCEVCInterface_WriteIncentiveTableDescriptions_Call struct { } // WriteIncentiveTableDescriptions is a helper method to define mock.On call -// - entity api.EntityRemoteInterface -// - data []api0.IncentiveTariffDescription +// - entity spine_goapi.EntityRemoteInterface +// - data []api.IncentiveTariffDescription func (_e *CemCEVCInterface_Expecter) WriteIncentiveTableDescriptions(entity interface{}, data interface{}) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { return &CemCEVCInterface_WriteIncentiveTableDescriptions_Call{Call: _e.mock.On("WriteIncentiveTableDescriptions", entity, data)} } -func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) Run(run func(entity api.EntityRemoteInterface, data []api0.IncentiveTariffDescription)) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { +func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, data []api.IncentiveTariffDescription)) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 []api0.IncentiveTariffDescription - if args[1] != nil { - arg1 = args[1].([]api0.IncentiveTariffDescription) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].([]api.IncentiveTariffDescription)) }) return _c } -func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) Return(err error) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { - _c.Call.Return(err) +func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) Return(_a0 error) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, data []api0.IncentiveTariffDescription) error) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { +func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, []api.IncentiveTariffDescription) error) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { _c.Call.Return(run) return _c } -// WriteIncentives provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) WriteIncentives(entity api.EntityRemoteInterface, data []api0.DurationSlotValue) error { - ret := _mock.Called(entity, data) +// WriteIncentives provides a mock function with given fields: entity, data +func (_m *CemCEVCInterface) WriteIncentives(entity spine_goapi.EntityRemoteInterface, data []api.DurationSlotValue) error { + ret := _m.Called(entity, data) if len(ret) == 0 { panic("no return value specified for WriteIncentives") } var r0 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.DurationSlotValue) error); ok { - r0 = returnFunc(entity, data) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.DurationSlotValue) error); ok { + r0 = rf(entity, data) } else { r0 = ret.Error(0) } + return r0 } @@ -945,54 +863,44 @@ type CemCEVCInterface_WriteIncentives_Call struct { } // WriteIncentives is a helper method to define mock.On call -// - entity api.EntityRemoteInterface -// - data []api0.DurationSlotValue +// - entity spine_goapi.EntityRemoteInterface +// - data []api.DurationSlotValue func (_e *CemCEVCInterface_Expecter) WriteIncentives(entity interface{}, data interface{}) *CemCEVCInterface_WriteIncentives_Call { return &CemCEVCInterface_WriteIncentives_Call{Call: _e.mock.On("WriteIncentives", entity, data)} } -func (_c *CemCEVCInterface_WriteIncentives_Call) Run(run func(entity api.EntityRemoteInterface, data []api0.DurationSlotValue)) *CemCEVCInterface_WriteIncentives_Call { +func (_c *CemCEVCInterface_WriteIncentives_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, data []api.DurationSlotValue)) *CemCEVCInterface_WriteIncentives_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 []api0.DurationSlotValue - if args[1] != nil { - arg1 = args[1].([]api0.DurationSlotValue) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].([]api.DurationSlotValue)) }) return _c } -func (_c *CemCEVCInterface_WriteIncentives_Call) Return(err error) *CemCEVCInterface_WriteIncentives_Call { - _c.Call.Return(err) +func (_c *CemCEVCInterface_WriteIncentives_Call) Return(_a0 error) *CemCEVCInterface_WriteIncentives_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemCEVCInterface_WriteIncentives_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, data []api0.DurationSlotValue) error) *CemCEVCInterface_WriteIncentives_Call { +func (_c *CemCEVCInterface_WriteIncentives_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, []api.DurationSlotValue) error) *CemCEVCInterface_WriteIncentives_Call { _c.Call.Return(run) return _c } -// WritePowerLimits provides a mock function for the type CemCEVCInterface -func (_mock *CemCEVCInterface) WritePowerLimits(entity api.EntityRemoteInterface, data []api0.DurationSlotValue) error { - ret := _mock.Called(entity, data) +// WritePowerLimits provides a mock function with given fields: entity, data +func (_m *CemCEVCInterface) WritePowerLimits(entity spine_goapi.EntityRemoteInterface, data []api.DurationSlotValue) error { + ret := _m.Called(entity, data) if len(ret) == 0 { panic("no return value specified for WritePowerLimits") } var r0 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.DurationSlotValue) error); ok { - r0 = returnFunc(entity, data) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.DurationSlotValue) error); ok { + r0 = rf(entity, data) } else { r0 = ret.Error(0) } + return r0 } @@ -1002,36 +910,39 @@ type CemCEVCInterface_WritePowerLimits_Call struct { } // WritePowerLimits is a helper method to define mock.On call -// - entity api.EntityRemoteInterface -// - data []api0.DurationSlotValue +// - entity spine_goapi.EntityRemoteInterface +// - data []api.DurationSlotValue func (_e *CemCEVCInterface_Expecter) WritePowerLimits(entity interface{}, data interface{}) *CemCEVCInterface_WritePowerLimits_Call { return &CemCEVCInterface_WritePowerLimits_Call{Call: _e.mock.On("WritePowerLimits", entity, data)} } -func (_c *CemCEVCInterface_WritePowerLimits_Call) Run(run func(entity api.EntityRemoteInterface, data []api0.DurationSlotValue)) *CemCEVCInterface_WritePowerLimits_Call { +func (_c *CemCEVCInterface_WritePowerLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, data []api.DurationSlotValue)) *CemCEVCInterface_WritePowerLimits_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 []api0.DurationSlotValue - if args[1] != nil { - arg1 = args[1].([]api0.DurationSlotValue) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].([]api.DurationSlotValue)) }) return _c } -func (_c *CemCEVCInterface_WritePowerLimits_Call) Return(err error) *CemCEVCInterface_WritePowerLimits_Call { - _c.Call.Return(err) +func (_c *CemCEVCInterface_WritePowerLimits_Call) Return(_a0 error) *CemCEVCInterface_WritePowerLimits_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemCEVCInterface_WritePowerLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, data []api0.DurationSlotValue) error) *CemCEVCInterface_WritePowerLimits_Call { +func (_c *CemCEVCInterface_WritePowerLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, []api.DurationSlotValue) error) *CemCEVCInterface_WritePowerLimits_Call { _c.Call.Return(run) return _c } + +// NewCemCEVCInterface creates a new instance of CemCEVCInterface. 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 NewCemCEVCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemCEVCInterface { + mock := &CemCEVCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/CemEVCCInterface.go b/usecases/mocks/CemEVCCInterface.go index a6ec3e4f..e0c845c0 100644 --- a/usecases/mocks/CemEVCCInterface.go +++ b/usecases/mocks/CemEVCCInterface.go @@ -1,30 +1,17 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api1 "github.com/enbility/eebus-go/api" - api0 "github.com/enbility/eebus-go/usecases/api" - "github.com/enbility/spine-go/api" - "github.com/enbility/spine-go/model" - mock "github.com/stretchr/testify/mock" -) + eebus_goapi "github.com/enbility/eebus-go/api" + api "github.com/enbility/eebus-go/usecases/api" -// NewCemEVCCInterface creates a new instance of CemEVCCInterface. 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 NewCemEVCCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemEVCCInterface { - mock := &CemEVCCInterface{} - mock.Mock.Test(t) + mock "github.com/stretchr/testify/mock" - t.Cleanup(func() { mock.AssertExpectations(t) }) + model "github.com/enbility/spine-go/model" - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // CemEVCCInterface is an autogenerated mock type for the CemEVCCInterface type type CemEVCCInterface struct { @@ -39,20 +26,21 @@ func (_m *CemEVCCInterface) EXPECT() *CemEVCCInterface_Expecter { return &CemEVCCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *CemEVCCInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -73,8 +61,8 @@ func (_c *CemEVCCInterface_AddFeatures_Call) Run(run func()) *CemEVCCInterface_A return _c } -func (_c *CemEVCCInterface_AddFeatures_Call) Return(err error) *CemEVCCInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *CemEVCCInterface_AddFeatures_Call) Return(_a0 error) *CemEVCCInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -83,10 +71,9 @@ func (_c *CemEVCCInterface_AddFeatures_Call) RunAndReturn(run func() error) *Cem return _c } -// AddUseCase provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *CemEVCCInterface) AddUseCase() { + _m.Called() } // CemEVCCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -116,9 +103,9 @@ func (_c *CemEVCCInterface_AddUseCase_Call) RunAndReturn(run func()) *CemEVCCInt return _c } -// AsymmetricChargingSupport provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) AsymmetricChargingSupport(entity api.EntityRemoteInterface) (bool, error) { - ret := _mock.Called(entity) +// AsymmetricChargingSupport provides a mock function with given fields: entity +func (_m *CemEVCCInterface) AsymmetricChargingSupport(entity spine_goapi.EntityRemoteInterface) (bool, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AsymmetricChargingSupport") @@ -126,19 +113,21 @@ func (_mock *CemEVCCInterface) AsymmetricChargingSupport(entity api.EntityRemote var r0 bool var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (bool, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (bool, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -148,50 +137,45 @@ type CemEVCCInterface_AsymmetricChargingSupport_Call struct { } // AsymmetricChargingSupport is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) AsymmetricChargingSupport(entity interface{}) *CemEVCCInterface_AsymmetricChargingSupport_Call { return &CemEVCCInterface_AsymmetricChargingSupport_Call{Call: _e.mock.On("AsymmetricChargingSupport", entity)} } -func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_AsymmetricChargingSupport_Call { +func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_AsymmetricChargingSupport_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) Return(b bool, err error) *CemEVCCInterface_AsymmetricChargingSupport_Call { - _c.Call.Return(b, err) +func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) Return(_a0 bool, _a1 error) *CemEVCCInterface_AsymmetricChargingSupport_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (bool, error)) *CemEVCCInterface_AsymmetricChargingSupport_Call { +func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (bool, error)) *CemEVCCInterface_AsymmetricChargingSupport_Call { _c.Call.Return(run) return _c } -// AvailableScenariosForEntity provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *CemEVCCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -201,57 +185,53 @@ type CemEVCCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemEVCCInterface_AvailableScenariosForEntity_Call { return &CemEVCCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemEVCCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemEVCCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemEVCCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemEVCCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// ChargeState provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) ChargeState(entity api.EntityRemoteInterface) (api0.EVChargeStateType, error) { - ret := _mock.Called(entity) +// ChargeState provides a mock function with given fields: entity +func (_m *CemEVCCInterface) ChargeState(entity spine_goapi.EntityRemoteInterface) (api.EVChargeStateType, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for ChargeState") } - var r0 api0.EVChargeStateType + var r0 api.EVChargeStateType var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.EVChargeStateType, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.EVChargeStateType, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.EVChargeStateType); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.EVChargeStateType); ok { + r0 = rf(entity) } else { - r0 = ret.Get(0).(api0.EVChargeStateType) + r0 = ret.Get(0).(api.EVChargeStateType) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -261,37 +241,31 @@ type CemEVCCInterface_ChargeState_Call struct { } // ChargeState is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) ChargeState(entity interface{}) *CemEVCCInterface_ChargeState_Call { return &CemEVCCInterface_ChargeState_Call{Call: _e.mock.On("ChargeState", entity)} } -func (_c *CemEVCCInterface_ChargeState_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_ChargeState_Call { +func (_c *CemEVCCInterface_ChargeState_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_ChargeState_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCCInterface_ChargeState_Call) Return(eVChargeStateType api0.EVChargeStateType, err error) *CemEVCCInterface_ChargeState_Call { - _c.Call.Return(eVChargeStateType, err) +func (_c *CemEVCCInterface_ChargeState_Call) Return(_a0 api.EVChargeStateType, _a1 error) *CemEVCCInterface_ChargeState_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVCCInterface_ChargeState_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.EVChargeStateType, error)) *CemEVCCInterface_ChargeState_Call { +func (_c *CemEVCCInterface_ChargeState_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.EVChargeStateType, error)) *CemEVCCInterface_ChargeState_Call { _c.Call.Return(run) return _c } -// ChargingPowerLimits provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) ChargingPowerLimits(entity api.EntityRemoteInterface) (float64, float64, float64, error) { - ret := _mock.Called(entity) +// ChargingPowerLimits provides a mock function with given fields: entity +func (_m *CemEVCCInterface) ChargingPowerLimits(entity spine_goapi.EntityRemoteInterface) (float64, float64, float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for ChargingPowerLimits") @@ -301,29 +275,33 @@ func (_mock *CemEVCCInterface) ChargingPowerLimits(entity api.EntityRemoteInterf var r1 float64 var r2 float64 var r3 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, float64, float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, float64, float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) float64); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r1 = rf(entity) } else { r1 = ret.Get(1).(float64) } - if returnFunc, ok := ret.Get(2).(func(api.EntityRemoteInterface) float64); ok { - r2 = returnFunc(entity) + + if rf, ok := ret.Get(2).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r2 = rf(entity) } else { r2 = ret.Get(2).(float64) } - if returnFunc, ok := ret.Get(3).(func(api.EntityRemoteInterface) error); ok { - r3 = returnFunc(entity) + + if rf, ok := ret.Get(3).(func(spine_goapi.EntityRemoteInterface) error); ok { + r3 = rf(entity) } else { r3 = ret.Error(3) } + return r0, r1, r2, r3 } @@ -333,37 +311,31 @@ type CemEVCCInterface_ChargingPowerLimits_Call struct { } // ChargingPowerLimits is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) ChargingPowerLimits(entity interface{}) *CemEVCCInterface_ChargingPowerLimits_Call { return &CemEVCCInterface_ChargingPowerLimits_Call{Call: _e.mock.On("ChargingPowerLimits", entity)} } -func (_c *CemEVCCInterface_ChargingPowerLimits_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_ChargingPowerLimits_Call { +func (_c *CemEVCCInterface_ChargingPowerLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_ChargingPowerLimits_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCCInterface_ChargingPowerLimits_Call) Return(f float64, f1 float64, f2 float64, err error) *CemEVCCInterface_ChargingPowerLimits_Call { - _c.Call.Return(f, f1, f2, err) +func (_c *CemEVCCInterface_ChargingPowerLimits_Call) Return(_a0 float64, _a1 float64, _a2 float64, _a3 error) *CemEVCCInterface_ChargingPowerLimits_Call { + _c.Call.Return(_a0, _a1, _a2, _a3) return _c } -func (_c *CemEVCCInterface_ChargingPowerLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, float64, float64, error)) *CemEVCCInterface_ChargingPowerLimits_Call { +func (_c *CemEVCCInterface_ChargingPowerLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, float64, float64, error)) *CemEVCCInterface_ChargingPowerLimits_Call { _c.Call.Return(run) return _c } -// CommunicationStandard provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) CommunicationStandard(entity api.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error) { - ret := _mock.Called(entity) +// CommunicationStandard provides a mock function with given fields: entity +func (_m *CemEVCCInterface) CommunicationStandard(entity spine_goapi.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for CommunicationStandard") @@ -371,19 +343,21 @@ func (_mock *CemEVCCInterface) CommunicationStandard(entity api.EntityRemoteInte var r0 model.DeviceConfigurationKeyValueStringType var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) model.DeviceConfigurationKeyValueStringType); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) model.DeviceConfigurationKeyValueStringType); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(model.DeviceConfigurationKeyValueStringType) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -393,48 +367,43 @@ type CemEVCCInterface_CommunicationStandard_Call struct { } // CommunicationStandard is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) CommunicationStandard(entity interface{}) *CemEVCCInterface_CommunicationStandard_Call { return &CemEVCCInterface_CommunicationStandard_Call{Call: _e.mock.On("CommunicationStandard", entity)} } -func (_c *CemEVCCInterface_CommunicationStandard_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_CommunicationStandard_Call { +func (_c *CemEVCCInterface_CommunicationStandard_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_CommunicationStandard_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCCInterface_CommunicationStandard_Call) Return(deviceConfigurationKeyValueStringType model.DeviceConfigurationKeyValueStringType, err error) *CemEVCCInterface_CommunicationStandard_Call { - _c.Call.Return(deviceConfigurationKeyValueStringType, err) +func (_c *CemEVCCInterface_CommunicationStandard_Call) Return(_a0 model.DeviceConfigurationKeyValueStringType, _a1 error) *CemEVCCInterface_CommunicationStandard_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVCCInterface_CommunicationStandard_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error)) *CemEVCCInterface_CommunicationStandard_Call { +func (_c *CemEVCCInterface_CommunicationStandard_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error)) *CemEVCCInterface_CommunicationStandard_Call { _c.Call.Return(run) return _c } -// EVConnected provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) EVConnected(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// EVConnected provides a mock function with given fields: entity +func (_m *CemEVCCInterface) EVConnected(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for EVConnected") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -444,59 +413,55 @@ type CemEVCCInterface_EVConnected_Call struct { } // EVConnected is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) EVConnected(entity interface{}) *CemEVCCInterface_EVConnected_Call { return &CemEVCCInterface_EVConnected_Call{Call: _e.mock.On("EVConnected", entity)} } -func (_c *CemEVCCInterface_EVConnected_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_EVConnected_Call { +func (_c *CemEVCCInterface_EVConnected_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_EVConnected_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCCInterface_EVConnected_Call) Return(b bool) *CemEVCCInterface_EVConnected_Call { - _c.Call.Return(b) +func (_c *CemEVCCInterface_EVConnected_Call) Return(_a0 bool) *CemEVCCInterface_EVConnected_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVCCInterface_EVConnected_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemEVCCInterface_EVConnected_Call { +func (_c *CemEVCCInterface_EVConnected_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemEVCCInterface_EVConnected_Call { _c.Call.Return(run) return _c } -// Identifications provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) Identifications(entity api.EntityRemoteInterface) ([]api0.IdentificationItem, error) { - ret := _mock.Called(entity) +// Identifications provides a mock function with given fields: entity +func (_m *CemEVCCInterface) Identifications(entity spine_goapi.EntityRemoteInterface) ([]api.IdentificationItem, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for Identifications") } - var r0 []api0.IdentificationItem + var r0 []api.IdentificationItem var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]api0.IdentificationItem, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]api.IdentificationItem, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []api0.IdentificationItem); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []api.IdentificationItem); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.IdentificationItem) + r0 = ret.Get(0).([]api.IdentificationItem) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -506,48 +471,43 @@ type CemEVCCInterface_Identifications_Call struct { } // Identifications is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) Identifications(entity interface{}) *CemEVCCInterface_Identifications_Call { return &CemEVCCInterface_Identifications_Call{Call: _e.mock.On("Identifications", entity)} } -func (_c *CemEVCCInterface_Identifications_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_Identifications_Call { +func (_c *CemEVCCInterface_Identifications_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_Identifications_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCCInterface_Identifications_Call) Return(identificationItems []api0.IdentificationItem, err error) *CemEVCCInterface_Identifications_Call { - _c.Call.Return(identificationItems, err) +func (_c *CemEVCCInterface_Identifications_Call) Return(_a0 []api.IdentificationItem, _a1 error) *CemEVCCInterface_Identifications_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVCCInterface_Identifications_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]api0.IdentificationItem, error)) *CemEVCCInterface_Identifications_Call { +func (_c *CemEVCCInterface_Identifications_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]api.IdentificationItem, error)) *CemEVCCInterface_Identifications_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *CemEVCCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -557,37 +517,31 @@ type CemEVCCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemEVCCInterface_IsCompatibleEntityType_Call { return &CemEVCCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) Return(b bool) *CemEVCCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemEVCCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemEVCCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemEVCCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsInSleepMode provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) IsInSleepMode(entity api.EntityRemoteInterface) (bool, error) { - ret := _mock.Called(entity) +// IsInSleepMode provides a mock function with given fields: entity +func (_m *CemEVCCInterface) IsInSleepMode(entity spine_goapi.EntityRemoteInterface) (bool, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsInSleepMode") @@ -595,19 +549,21 @@ func (_mock *CemEVCCInterface) IsInSleepMode(entity api.EntityRemoteInterface) ( var r0 bool var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (bool, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (bool, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -617,48 +573,43 @@ type CemEVCCInterface_IsInSleepMode_Call struct { } // IsInSleepMode is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) IsInSleepMode(entity interface{}) *CemEVCCInterface_IsInSleepMode_Call { return &CemEVCCInterface_IsInSleepMode_Call{Call: _e.mock.On("IsInSleepMode", entity)} } -func (_c *CemEVCCInterface_IsInSleepMode_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_IsInSleepMode_Call { +func (_c *CemEVCCInterface_IsInSleepMode_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_IsInSleepMode_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCCInterface_IsInSleepMode_Call) Return(b bool, err error) *CemEVCCInterface_IsInSleepMode_Call { - _c.Call.Return(b, err) +func (_c *CemEVCCInterface_IsInSleepMode_Call) Return(_a0 bool, _a1 error) *CemEVCCInterface_IsInSleepMode_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVCCInterface_IsInSleepMode_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (bool, error)) *CemEVCCInterface_IsInSleepMode_Call { +func (_c *CemEVCCInterface_IsInSleepMode_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (bool, error)) *CemEVCCInterface_IsInSleepMode_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *CemEVCCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -668,63 +619,54 @@ type CemEVCCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *CemEVCCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { return &CemEVCCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// ManufacturerData provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) ManufacturerData(entity api.EntityRemoteInterface) (api0.ManufacturerData, error) { - ret := _mock.Called(entity) +// ManufacturerData provides a mock function with given fields: entity +func (_m *CemEVCCInterface) ManufacturerData(entity spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for ManufacturerData") } - var r0 api0.ManufacturerData + var r0 api.ManufacturerData var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.ManufacturerData, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.ManufacturerData); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.ManufacturerData); ok { + r0 = rf(entity) } else { - r0 = ret.Get(0).(api0.ManufacturerData) + r0 = ret.Get(0).(api.ManufacturerData) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -734,50 +676,45 @@ type CemEVCCInterface_ManufacturerData_Call struct { } // ManufacturerData is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) ManufacturerData(entity interface{}) *CemEVCCInterface_ManufacturerData_Call { return &CemEVCCInterface_ManufacturerData_Call{Call: _e.mock.On("ManufacturerData", entity)} } -func (_c *CemEVCCInterface_ManufacturerData_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_ManufacturerData_Call { +func (_c *CemEVCCInterface_ManufacturerData_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_ManufacturerData_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCCInterface_ManufacturerData_Call) Return(manufacturerData api0.ManufacturerData, err error) *CemEVCCInterface_ManufacturerData_Call { - _c.Call.Return(manufacturerData, err) +func (_c *CemEVCCInterface_ManufacturerData_Call) Return(_a0 api.ManufacturerData, _a1 error) *CemEVCCInterface_ManufacturerData_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVCCInterface_ManufacturerData_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.ManufacturerData, error)) *CemEVCCInterface_ManufacturerData_Call { +func (_c *CemEVCCInterface_ManufacturerData_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error)) *CemEVCCInterface_ManufacturerData_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *CemEVCCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api1.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api1.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -798,20 +735,19 @@ func (_c *CemEVCCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemEVC return _c } -func (_c *CemEVCCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CemEVCCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *CemEVCCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemEVCCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVCCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CemEVCCInterface_RemoteEntitiesScenarios_Call { +func (_c *CemEVCCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemEVCCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *CemEVCCInterface) RemoveUseCase() { + _m.Called() } // CemEVCCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -841,10 +777,9 @@ func (_c *CemEVCCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemEVCC return _c } -// UpdateUseCaseAvailability provides a mock function for the type CemEVCCInterface -func (_mock *CemEVCCInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *CemEVCCInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // CemEVCCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -860,13 +795,7 @@ func (_e *CemEVCCInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *CemEVCCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemEVCCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -876,7 +805,21 @@ func (_c *CemEVCCInterface_UpdateUseCaseAvailability_Call) Return() *CemEVCCInte return _c } -func (_c *CemEVCCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemEVCCInterface_UpdateUseCaseAvailability_Call { +func (_c *CemEVCCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemEVCCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } + +// NewCemEVCCInterface creates a new instance of CemEVCCInterface. 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 NewCemEVCCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemEVCCInterface { + mock := &CemEVCCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/CemEVCEMInterface.go b/usecases/mocks/CemEVCEMInterface.go index ad688652..4876a7f3 100644 --- a/usecases/mocks/CemEVCEMInterface.go +++ b/usecases/mocks/CemEVCEMInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api0 "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/api" + eebus_goapi "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) -// NewCemEVCEMInterface creates a new instance of CemEVCEMInterface. 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 NewCemEVCEMInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemEVCEMInterface { - mock := &CemEVCEMInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // CemEVCEMInterface is an autogenerated mock type for the CemEVCEMInterface type type CemEVCEMInterface struct { @@ -37,20 +22,21 @@ func (_m *CemEVCEMInterface) EXPECT() *CemEVCEMInterface_Expecter { return &CemEVCEMInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *CemEVCEMInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -71,8 +57,8 @@ func (_c *CemEVCEMInterface_AddFeatures_Call) Run(run func()) *CemEVCEMInterface return _c } -func (_c *CemEVCEMInterface_AddFeatures_Call) Return(err error) *CemEVCEMInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *CemEVCEMInterface_AddFeatures_Call) Return(_a0 error) *CemEVCEMInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -81,10 +67,9 @@ func (_c *CemEVCEMInterface_AddFeatures_Call) RunAndReturn(run func() error) *Ce return _c } -// AddUseCase provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *CemEVCEMInterface) AddUseCase() { + _m.Called() } // CemEVCEMInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -114,22 +99,23 @@ func (_c *CemEVCEMInterface_AddUseCase_Call) RunAndReturn(run func()) *CemEVCEMI return _c } -// AvailableScenariosForEntity provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *CemEVCEMInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -139,37 +125,31 @@ type CemEVCEMInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemEVCEMInterface_AvailableScenariosForEntity_Call { return &CemEVCEMInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemEVCEMInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemEVCEMInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemEVCEMInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemEVCEMInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentPerPhase provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) CurrentPerPhase(entity api.EntityRemoteInterface) ([]float64, error) { - ret := _mock.Called(entity) +// CurrentPerPhase provides a mock function with given fields: entity +func (_m *CemEVCEMInterface) CurrentPerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for CurrentPerPhase") @@ -177,21 +157,23 @@ func (_mock *CemEVCEMInterface) CurrentPerPhase(entity api.EntityRemoteInterface var r0 []float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -201,37 +183,31 @@ type CemEVCEMInterface_CurrentPerPhase_Call struct { } // CurrentPerPhase is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) CurrentPerPhase(entity interface{}) *CemEVCEMInterface_CurrentPerPhase_Call { return &CemEVCEMInterface_CurrentPerPhase_Call{Call: _e.mock.On("CurrentPerPhase", entity)} } -func (_c *CemEVCEMInterface_CurrentPerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_CurrentPerPhase_Call { +func (_c *CemEVCEMInterface_CurrentPerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_CurrentPerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCEMInterface_CurrentPerPhase_Call) Return(float64s []float64, err error) *CemEVCEMInterface_CurrentPerPhase_Call { - _c.Call.Return(float64s, err) +func (_c *CemEVCEMInterface_CurrentPerPhase_Call) Return(_a0 []float64, _a1 error) *CemEVCEMInterface_CurrentPerPhase_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVCEMInterface_CurrentPerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *CemEVCEMInterface_CurrentPerPhase_Call { +func (_c *CemEVCEMInterface_CurrentPerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *CemEVCEMInterface_CurrentPerPhase_Call { _c.Call.Return(run) return _c } -// EnergyCharged provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) EnergyCharged(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// EnergyCharged provides a mock function with given fields: entity +func (_m *CemEVCEMInterface) EnergyCharged(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyCharged") @@ -239,19 +215,21 @@ func (_mock *CemEVCEMInterface) EnergyCharged(entity api.EntityRemoteInterface) var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -261,48 +239,43 @@ type CemEVCEMInterface_EnergyCharged_Call struct { } // EnergyCharged is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) EnergyCharged(entity interface{}) *CemEVCEMInterface_EnergyCharged_Call { return &CemEVCEMInterface_EnergyCharged_Call{Call: _e.mock.On("EnergyCharged", entity)} } -func (_c *CemEVCEMInterface_EnergyCharged_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_EnergyCharged_Call { +func (_c *CemEVCEMInterface_EnergyCharged_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_EnergyCharged_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCEMInterface_EnergyCharged_Call) Return(f float64, err error) *CemEVCEMInterface_EnergyCharged_Call { - _c.Call.Return(f, err) +func (_c *CemEVCEMInterface_EnergyCharged_Call) Return(_a0 float64, _a1 error) *CemEVCEMInterface_EnergyCharged_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVCEMInterface_EnergyCharged_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemEVCEMInterface_EnergyCharged_Call { +func (_c *CemEVCEMInterface_EnergyCharged_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemEVCEMInterface_EnergyCharged_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *CemEVCEMInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -312,48 +285,43 @@ type CemEVCEMInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemEVCEMInterface_IsCompatibleEntityType_Call { return &CemEVCEMInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_IsCompatibleEntityType_Call { +func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) Return(b bool) *CemEVCEMInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemEVCEMInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemEVCEMInterface_IsCompatibleEntityType_Call { +func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemEVCEMInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *CemEVCEMInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -363,43 +331,32 @@ type CemEVCEMInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *CemEVCEMInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { return &CemEVCEMInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// PhasesConnected provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) PhasesConnected(entity api.EntityRemoteInterface) (uint, error) { - ret := _mock.Called(entity) +// PhasesConnected provides a mock function with given fields: entity +func (_m *CemEVCEMInterface) PhasesConnected(entity spine_goapi.EntityRemoteInterface) (uint, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for PhasesConnected") @@ -407,19 +364,21 @@ func (_mock *CemEVCEMInterface) PhasesConnected(entity api.EntityRemoteInterface var r0 uint var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (uint, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (uint, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) uint); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(uint) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -429,37 +388,31 @@ type CemEVCEMInterface_PhasesConnected_Call struct { } // PhasesConnected is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) PhasesConnected(entity interface{}) *CemEVCEMInterface_PhasesConnected_Call { return &CemEVCEMInterface_PhasesConnected_Call{Call: _e.mock.On("PhasesConnected", entity)} } -func (_c *CemEVCEMInterface_PhasesConnected_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_PhasesConnected_Call { +func (_c *CemEVCEMInterface_PhasesConnected_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_PhasesConnected_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCEMInterface_PhasesConnected_Call) Return(v uint, err error) *CemEVCEMInterface_PhasesConnected_Call { - _c.Call.Return(v, err) +func (_c *CemEVCEMInterface_PhasesConnected_Call) Return(_a0 uint, _a1 error) *CemEVCEMInterface_PhasesConnected_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVCEMInterface_PhasesConnected_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (uint, error)) *CemEVCEMInterface_PhasesConnected_Call { +func (_c *CemEVCEMInterface_PhasesConnected_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (uint, error)) *CemEVCEMInterface_PhasesConnected_Call { _c.Call.Return(run) return _c } -// PowerPerPhase provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) PowerPerPhase(entity api.EntityRemoteInterface) ([]float64, error) { - ret := _mock.Called(entity) +// PowerPerPhase provides a mock function with given fields: entity +func (_m *CemEVCEMInterface) PowerPerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for PowerPerPhase") @@ -467,21 +420,23 @@ func (_mock *CemEVCEMInterface) PowerPerPhase(entity api.EntityRemoteInterface) var r0 []float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -491,50 +446,45 @@ type CemEVCEMInterface_PowerPerPhase_Call struct { } // PowerPerPhase is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) PowerPerPhase(entity interface{}) *CemEVCEMInterface_PowerPerPhase_Call { return &CemEVCEMInterface_PowerPerPhase_Call{Call: _e.mock.On("PowerPerPhase", entity)} } -func (_c *CemEVCEMInterface_PowerPerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_PowerPerPhase_Call { +func (_c *CemEVCEMInterface_PowerPerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_PowerPerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVCEMInterface_PowerPerPhase_Call) Return(float64s []float64, err error) *CemEVCEMInterface_PowerPerPhase_Call { - _c.Call.Return(float64s, err) +func (_c *CemEVCEMInterface_PowerPerPhase_Call) Return(_a0 []float64, _a1 error) *CemEVCEMInterface_PowerPerPhase_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVCEMInterface_PowerPerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *CemEVCEMInterface_PowerPerPhase_Call { +func (_c *CemEVCEMInterface_PowerPerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *CemEVCEMInterface_PowerPerPhase_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *CemEVCEMInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api0.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -555,20 +505,19 @@ func (_c *CemEVCEMInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemEV return _c } -func (_c *CemEVCEMInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *CemEVCEMInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *CemEVCEMInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemEVCEMInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVCEMInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *CemEVCEMInterface_RemoteEntitiesScenarios_Call { +func (_c *CemEVCEMInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemEVCEMInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *CemEVCEMInterface) RemoveUseCase() { + _m.Called() } // CemEVCEMInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -598,10 +547,9 @@ func (_c *CemEVCEMInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemEVC return _c } -// UpdateUseCaseAvailability provides a mock function for the type CemEVCEMInterface -func (_mock *CemEVCEMInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *CemEVCEMInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // CemEVCEMInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -617,13 +565,7 @@ func (_e *CemEVCEMInterface_Expecter) UpdateUseCaseAvailability(available interf func (_c *CemEVCEMInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemEVCEMInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -633,7 +575,21 @@ func (_c *CemEVCEMInterface_UpdateUseCaseAvailability_Call) Return() *CemEVCEMIn return _c } -func (_c *CemEVCEMInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemEVCEMInterface_UpdateUseCaseAvailability_Call { +func (_c *CemEVCEMInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemEVCEMInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } + +// NewCemEVCEMInterface creates a new instance of CemEVCEMInterface. 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 NewCemEVCEMInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemEVCEMInterface { + mock := &CemEVCEMInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/CemEVSECCInterface.go b/usecases/mocks/CemEVSECCInterface.go index 239d37be..64d2391e 100644 --- a/usecases/mocks/CemEVSECCInterface.go +++ b/usecases/mocks/CemEVSECCInterface.go @@ -1,30 +1,17 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api1 "github.com/enbility/eebus-go/api" - api0 "github.com/enbility/eebus-go/usecases/api" - "github.com/enbility/spine-go/api" - "github.com/enbility/spine-go/model" - mock "github.com/stretchr/testify/mock" -) + eebus_goapi "github.com/enbility/eebus-go/api" + api "github.com/enbility/eebus-go/usecases/api" -// NewCemEVSECCInterface creates a new instance of CemEVSECCInterface. 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 NewCemEVSECCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemEVSECCInterface { - mock := &CemEVSECCInterface{} - mock.Mock.Test(t) + mock "github.com/stretchr/testify/mock" - t.Cleanup(func() { mock.AssertExpectations(t) }) + model "github.com/enbility/spine-go/model" - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // CemEVSECCInterface is an autogenerated mock type for the CemEVSECCInterface type type CemEVSECCInterface struct { @@ -39,20 +26,21 @@ func (_m *CemEVSECCInterface) EXPECT() *CemEVSECCInterface_Expecter { return &CemEVSECCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type CemEVSECCInterface -func (_mock *CemEVSECCInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *CemEVSECCInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -73,8 +61,8 @@ func (_c *CemEVSECCInterface_AddFeatures_Call) Run(run func()) *CemEVSECCInterfa return _c } -func (_c *CemEVSECCInterface_AddFeatures_Call) Return(err error) *CemEVSECCInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *CemEVSECCInterface_AddFeatures_Call) Return(_a0 error) *CemEVSECCInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -83,10 +71,9 @@ func (_c *CemEVSECCInterface_AddFeatures_Call) RunAndReturn(run func() error) *C return _c } -// AddUseCase provides a mock function for the type CemEVSECCInterface -func (_mock *CemEVSECCInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *CemEVSECCInterface) AddUseCase() { + _m.Called() } // CemEVSECCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -116,22 +103,23 @@ func (_c *CemEVSECCInterface_AddUseCase_Call) RunAndReturn(run func()) *CemEVSEC return _c } -// AvailableScenariosForEntity provides a mock function for the type CemEVSECCInterface -func (_mock *CemEVSECCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *CemEVSECCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -141,48 +129,43 @@ type CemEVSECCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVSECCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemEVSECCInterface_AvailableScenariosForEntity_Call { return &CemEVSECCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSECCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSECCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemEVSECCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemEVSECCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemEVSECCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemEVSECCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type CemEVSECCInterface -func (_mock *CemEVSECCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *CemEVSECCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -192,48 +175,43 @@ type CemEVSECCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVSECCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemEVSECCInterface_IsCompatibleEntityType_Call { return &CemEVSECCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSECCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSECCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) Return(b bool) *CemEVSECCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemEVSECCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemEVSECCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemEVSECCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type CemEVSECCInterface -func (_mock *CemEVSECCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *CemEVSECCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -243,63 +221,54 @@ type CemEVSECCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *CemEVSECCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { return &CemEVSECCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// ManufacturerData provides a mock function for the type CemEVSECCInterface -func (_mock *CemEVSECCInterface) ManufacturerData(entity api.EntityRemoteInterface) (api0.ManufacturerData, error) { - ret := _mock.Called(entity) +// ManufacturerData provides a mock function with given fields: entity +func (_m *CemEVSECCInterface) ManufacturerData(entity spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for ManufacturerData") } - var r0 api0.ManufacturerData + var r0 api.ManufacturerData var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.ManufacturerData, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.ManufacturerData); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.ManufacturerData); ok { + r0 = rf(entity) } else { - r0 = ret.Get(0).(api0.ManufacturerData) + r0 = ret.Get(0).(api.ManufacturerData) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -309,37 +278,31 @@ type CemEVSECCInterface_ManufacturerData_Call struct { } // ManufacturerData is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVSECCInterface_Expecter) ManufacturerData(entity interface{}) *CemEVSECCInterface_ManufacturerData_Call { return &CemEVSECCInterface_ManufacturerData_Call{Call: _e.mock.On("ManufacturerData", entity)} } -func (_c *CemEVSECCInterface_ManufacturerData_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSECCInterface_ManufacturerData_Call { +func (_c *CemEVSECCInterface_ManufacturerData_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSECCInterface_ManufacturerData_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVSECCInterface_ManufacturerData_Call) Return(manufacturerData api0.ManufacturerData, err error) *CemEVSECCInterface_ManufacturerData_Call { - _c.Call.Return(manufacturerData, err) +func (_c *CemEVSECCInterface_ManufacturerData_Call) Return(_a0 api.ManufacturerData, _a1 error) *CemEVSECCInterface_ManufacturerData_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVSECCInterface_ManufacturerData_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.ManufacturerData, error)) *CemEVSECCInterface_ManufacturerData_Call { +func (_c *CemEVSECCInterface_ManufacturerData_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error)) *CemEVSECCInterface_ManufacturerData_Call { _c.Call.Return(run) return _c } -// OperatingState provides a mock function for the type CemEVSECCInterface -func (_mock *CemEVSECCInterface) OperatingState(entity api.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error) { - ret := _mock.Called(entity) +// OperatingState provides a mock function with given fields: entity +func (_m *CemEVSECCInterface) OperatingState(entity spine_goapi.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for OperatingState") @@ -348,24 +311,27 @@ func (_mock *CemEVSECCInterface) OperatingState(entity api.EntityRemoteInterface var r0 model.DeviceDiagnosisOperatingStateType var r1 string var r2 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) model.DeviceDiagnosisOperatingStateType); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) model.DeviceDiagnosisOperatingStateType); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(model.DeviceDiagnosisOperatingStateType) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) string); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) string); ok { + r1 = rf(entity) } else { r1 = ret.Get(1).(string) } - if returnFunc, ok := ret.Get(2).(func(api.EntityRemoteInterface) error); ok { - r2 = returnFunc(entity) + + if rf, ok := ret.Get(2).(func(spine_goapi.EntityRemoteInterface) error); ok { + r2 = rf(entity) } else { r2 = ret.Error(2) } + return r0, r1, r2 } @@ -375,50 +341,45 @@ type CemEVSECCInterface_OperatingState_Call struct { } // OperatingState is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVSECCInterface_Expecter) OperatingState(entity interface{}) *CemEVSECCInterface_OperatingState_Call { return &CemEVSECCInterface_OperatingState_Call{Call: _e.mock.On("OperatingState", entity)} } -func (_c *CemEVSECCInterface_OperatingState_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSECCInterface_OperatingState_Call { +func (_c *CemEVSECCInterface_OperatingState_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSECCInterface_OperatingState_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVSECCInterface_OperatingState_Call) Return(deviceDiagnosisOperatingStateType model.DeviceDiagnosisOperatingStateType, s string, err error) *CemEVSECCInterface_OperatingState_Call { - _c.Call.Return(deviceDiagnosisOperatingStateType, s, err) +func (_c *CemEVSECCInterface_OperatingState_Call) Return(_a0 model.DeviceDiagnosisOperatingStateType, _a1 string, _a2 error) *CemEVSECCInterface_OperatingState_Call { + _c.Call.Return(_a0, _a1, _a2) return _c } -func (_c *CemEVSECCInterface_OperatingState_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error)) *CemEVSECCInterface_OperatingState_Call { +func (_c *CemEVSECCInterface_OperatingState_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error)) *CemEVSECCInterface_OperatingState_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type CemEVSECCInterface -func (_mock *CemEVSECCInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *CemEVSECCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api1.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api1.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -439,20 +400,19 @@ func (_c *CemEVSECCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemE return _c } -func (_c *CemEVSECCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CemEVSECCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *CemEVSECCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemEVSECCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVSECCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CemEVSECCInterface_RemoteEntitiesScenarios_Call { +func (_c *CemEVSECCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemEVSECCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type CemEVSECCInterface -func (_mock *CemEVSECCInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *CemEVSECCInterface) RemoveUseCase() { + _m.Called() } // CemEVSECCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -482,10 +442,9 @@ func (_c *CemEVSECCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemEV return _c } -// UpdateUseCaseAvailability provides a mock function for the type CemEVSECCInterface -func (_mock *CemEVSECCInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *CemEVSECCInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // CemEVSECCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -501,13 +460,7 @@ func (_e *CemEVSECCInterface_Expecter) UpdateUseCaseAvailability(available inter func (_c *CemEVSECCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemEVSECCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -517,7 +470,21 @@ func (_c *CemEVSECCInterface_UpdateUseCaseAvailability_Call) Return() *CemEVSECC return _c } -func (_c *CemEVSECCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemEVSECCInterface_UpdateUseCaseAvailability_Call { +func (_c *CemEVSECCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemEVSECCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } + +// NewCemEVSECCInterface creates a new instance of CemEVSECCInterface. 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 NewCemEVSECCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemEVSECCInterface { + mock := &CemEVSECCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/CemEVSOCInterface.go b/usecases/mocks/CemEVSOCInterface.go index d3c7e0ac..2f53810e 100644 --- a/usecases/mocks/CemEVSOCInterface.go +++ b/usecases/mocks/CemEVSOCInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api0 "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/api" + eebus_goapi "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) -// NewCemEVSOCInterface creates a new instance of CemEVSOCInterface. 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 NewCemEVSOCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemEVSOCInterface { - mock := &CemEVSOCInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // CemEVSOCInterface is an autogenerated mock type for the CemEVSOCInterface type type CemEVSOCInterface struct { @@ -37,20 +22,21 @@ func (_m *CemEVSOCInterface) EXPECT() *CemEVSOCInterface_Expecter { return &CemEVSOCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type CemEVSOCInterface -func (_mock *CemEVSOCInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *CemEVSOCInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -71,8 +57,8 @@ func (_c *CemEVSOCInterface_AddFeatures_Call) Run(run func()) *CemEVSOCInterface return _c } -func (_c *CemEVSOCInterface_AddFeatures_Call) Return(err error) *CemEVSOCInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *CemEVSOCInterface_AddFeatures_Call) Return(_a0 error) *CemEVSOCInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -81,10 +67,9 @@ func (_c *CemEVSOCInterface_AddFeatures_Call) RunAndReturn(run func() error) *Ce return _c } -// AddUseCase provides a mock function for the type CemEVSOCInterface -func (_mock *CemEVSOCInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *CemEVSOCInterface) AddUseCase() { + _m.Called() } // CemEVSOCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -114,22 +99,23 @@ func (_c *CemEVSOCInterface_AddUseCase_Call) RunAndReturn(run func()) *CemEVSOCI return _c } -// AvailableScenariosForEntity provides a mock function for the type CemEVSOCInterface -func (_mock *CemEVSOCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *CemEVSOCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -139,48 +125,43 @@ type CemEVSOCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVSOCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemEVSOCInterface_AvailableScenariosForEntity_Call { return &CemEVSOCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSOCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSOCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemEVSOCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemEVSOCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemEVSOCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemEVSOCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type CemEVSOCInterface -func (_mock *CemEVSOCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *CemEVSOCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -190,48 +171,43 @@ type CemEVSOCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVSOCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemEVSOCInterface_IsCompatibleEntityType_Call { return &CemEVSOCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSOCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSOCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) Return(b bool) *CemEVSOCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemEVSOCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemEVSOCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemEVSOCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type CemEVSOCInterface -func (_mock *CemEVSOCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *CemEVSOCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -241,56 +217,46 @@ type CemEVSOCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *CemEVSOCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { return &CemEVSOCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type CemEVSOCInterface -func (_mock *CemEVSOCInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *CemEVSOCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api0.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -311,20 +277,19 @@ func (_c *CemEVSOCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemEV return _c } -func (_c *CemEVSOCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *CemEVSOCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *CemEVSOCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemEVSOCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemEVSOCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *CemEVSOCInterface_RemoteEntitiesScenarios_Call { +func (_c *CemEVSOCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemEVSOCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type CemEVSOCInterface -func (_mock *CemEVSOCInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *CemEVSOCInterface) RemoveUseCase() { + _m.Called() } // CemEVSOCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -354,9 +319,9 @@ func (_c *CemEVSOCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemEVS return _c } -// StateOfCharge provides a mock function for the type CemEVSOCInterface -func (_mock *CemEVSOCInterface) StateOfCharge(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// StateOfCharge provides a mock function with given fields: entity +func (_m *CemEVSOCInterface) StateOfCharge(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for StateOfCharge") @@ -364,19 +329,21 @@ func (_mock *CemEVSOCInterface) StateOfCharge(entity api.EntityRemoteInterface) var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -386,38 +353,31 @@ type CemEVSOCInterface_StateOfCharge_Call struct { } // StateOfCharge is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemEVSOCInterface_Expecter) StateOfCharge(entity interface{}) *CemEVSOCInterface_StateOfCharge_Call { return &CemEVSOCInterface_StateOfCharge_Call{Call: _e.mock.On("StateOfCharge", entity)} } -func (_c *CemEVSOCInterface_StateOfCharge_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSOCInterface_StateOfCharge_Call { +func (_c *CemEVSOCInterface_StateOfCharge_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSOCInterface_StateOfCharge_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemEVSOCInterface_StateOfCharge_Call) Return(f float64, err error) *CemEVSOCInterface_StateOfCharge_Call { - _c.Call.Return(f, err) +func (_c *CemEVSOCInterface_StateOfCharge_Call) Return(_a0 float64, _a1 error) *CemEVSOCInterface_StateOfCharge_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemEVSOCInterface_StateOfCharge_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemEVSOCInterface_StateOfCharge_Call { +func (_c *CemEVSOCInterface_StateOfCharge_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemEVSOCInterface_StateOfCharge_Call { _c.Call.Return(run) return _c } -// UpdateUseCaseAvailability provides a mock function for the type CemEVSOCInterface -func (_mock *CemEVSOCInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *CemEVSOCInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // CemEVSOCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -433,13 +393,7 @@ func (_e *CemEVSOCInterface_Expecter) UpdateUseCaseAvailability(available interf func (_c *CemEVSOCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemEVSOCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -449,7 +403,21 @@ func (_c *CemEVSOCInterface_UpdateUseCaseAvailability_Call) Return() *CemEVSOCIn return _c } -func (_c *CemEVSOCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemEVSOCInterface_UpdateUseCaseAvailability_Call { +func (_c *CemEVSOCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemEVSOCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } + +// NewCemEVSOCInterface creates a new instance of CemEVSOCInterface. 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 NewCemEVSOCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemEVSOCInterface { + mock := &CemEVSOCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/CemOPEVInterface.go b/usecases/mocks/CemOPEVInterface.go index 6e4ae1fd..2040fb32 100644 --- a/usecases/mocks/CemOPEVInterface.go +++ b/usecases/mocks/CemOPEVInterface.go @@ -1,30 +1,17 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api1 "github.com/enbility/eebus-go/api" - api0 "github.com/enbility/eebus-go/usecases/api" - "github.com/enbility/spine-go/api" - "github.com/enbility/spine-go/model" - mock "github.com/stretchr/testify/mock" -) + eebus_goapi "github.com/enbility/eebus-go/api" + api "github.com/enbility/eebus-go/usecases/api" -// NewCemOPEVInterface creates a new instance of CemOPEVInterface. 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 NewCemOPEVInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemOPEVInterface { - mock := &CemOPEVInterface{} - mock.Mock.Test(t) + mock "github.com/stretchr/testify/mock" - t.Cleanup(func() { mock.AssertExpectations(t) }) + model "github.com/enbility/spine-go/model" - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // CemOPEVInterface is an autogenerated mock type for the CemOPEVInterface type type CemOPEVInterface struct { @@ -39,20 +26,21 @@ func (_m *CemOPEVInterface) EXPECT() *CemOPEVInterface_Expecter { return &CemOPEVInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *CemOPEVInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -73,8 +61,8 @@ func (_c *CemOPEVInterface_AddFeatures_Call) Run(run func()) *CemOPEVInterface_A return _c } -func (_c *CemOPEVInterface_AddFeatures_Call) Return(err error) *CemOPEVInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *CemOPEVInterface_AddFeatures_Call) Return(_a0 error) *CemOPEVInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -83,10 +71,9 @@ func (_c *CemOPEVInterface_AddFeatures_Call) RunAndReturn(run func() error) *Cem return _c } -// AddUseCase provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *CemOPEVInterface) AddUseCase() { + _m.Called() } // CemOPEVInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -116,22 +103,23 @@ func (_c *CemOPEVInterface_AddUseCase_Call) RunAndReturn(run func()) *CemOPEVInt return _c } -// AvailableScenariosForEntity provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *CemOPEVInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -141,37 +129,31 @@ type CemOPEVInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemOPEVInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemOPEVInterface_AvailableScenariosForEntity_Call { return &CemOPEVInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOPEVInterface_AvailableScenariosForEntity_Call { +func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOPEVInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemOPEVInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemOPEVInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemOPEVInterface_AvailableScenariosForEntity_Call { +func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemOPEVInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentLimits provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) CurrentLimits(entity api.EntityRemoteInterface) ([]float64, []float64, []float64, error) { - ret := _mock.Called(entity) +// CurrentLimits provides a mock function with given fields: entity +func (_m *CemOPEVInterface) CurrentLimits(entity spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for CurrentLimits") @@ -181,35 +163,39 @@ func (_mock *CemOPEVInterface) CurrentLimits(entity api.EntityRemoteInterface) ( var r1 []float64 var r2 []float64 var r3 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, []float64, []float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) []float64); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r1 = rf(entity) } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]float64) } } - if returnFunc, ok := ret.Get(2).(func(api.EntityRemoteInterface) []float64); ok { - r2 = returnFunc(entity) + + if rf, ok := ret.Get(2).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r2 = rf(entity) } else { if ret.Get(2) != nil { r2 = ret.Get(2).([]float64) } } - if returnFunc, ok := ret.Get(3).(func(api.EntityRemoteInterface) error); ok { - r3 = returnFunc(entity) + + if rf, ok := ret.Get(3).(func(spine_goapi.EntityRemoteInterface) error); ok { + r3 = rf(entity) } else { r3 = ret.Error(3) } + return r0, r1, r2, r3 } @@ -219,48 +205,43 @@ type CemOPEVInterface_CurrentLimits_Call struct { } // CurrentLimits is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemOPEVInterface_Expecter) CurrentLimits(entity interface{}) *CemOPEVInterface_CurrentLimits_Call { return &CemOPEVInterface_CurrentLimits_Call{Call: _e.mock.On("CurrentLimits", entity)} } -func (_c *CemOPEVInterface_CurrentLimits_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOPEVInterface_CurrentLimits_Call { +func (_c *CemOPEVInterface_CurrentLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOPEVInterface_CurrentLimits_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemOPEVInterface_CurrentLimits_Call) Return(float64s []float64, float64s1 []float64, float64s2 []float64, err error) *CemOPEVInterface_CurrentLimits_Call { - _c.Call.Return(float64s, float64s1, float64s2, err) +func (_c *CemOPEVInterface_CurrentLimits_Call) Return(_a0 []float64, _a1 []float64, _a2 []float64, _a3 error) *CemOPEVInterface_CurrentLimits_Call { + _c.Call.Return(_a0, _a1, _a2, _a3) return _c } -func (_c *CemOPEVInterface_CurrentLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, []float64, []float64, error)) *CemOPEVInterface_CurrentLimits_Call { +func (_c *CemOPEVInterface_CurrentLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error)) *CemOPEVInterface_CurrentLimits_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *CemOPEVInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -270,48 +251,43 @@ type CemOPEVInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemOPEVInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemOPEVInterface_IsCompatibleEntityType_Call { return &CemOPEVInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOPEVInterface_IsCompatibleEntityType_Call { +func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOPEVInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) Return(b bool) *CemOPEVInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemOPEVInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemOPEVInterface_IsCompatibleEntityType_Call { +func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemOPEVInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *CemOPEVInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -321,65 +297,56 @@ type CemOPEVInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *CemOPEVInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { return &CemOPEVInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// LoadControlLimits provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) LoadControlLimits(entity api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error) { - ret := _mock.Called(entity) +// LoadControlLimits provides a mock function with given fields: entity +func (_m *CemOPEVInterface) LoadControlLimits(entity spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for LoadControlLimits") } - var r0 []api0.LoadLimitsPhase + var r0 []api.LoadLimitsPhase var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []api0.LoadLimitsPhase); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []api.LoadLimitsPhase); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.LoadLimitsPhase) + r0 = ret.Get(0).([]api.LoadLimitsPhase) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -389,50 +356,45 @@ type CemOPEVInterface_LoadControlLimits_Call struct { } // LoadControlLimits is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemOPEVInterface_Expecter) LoadControlLimits(entity interface{}) *CemOPEVInterface_LoadControlLimits_Call { return &CemOPEVInterface_LoadControlLimits_Call{Call: _e.mock.On("LoadControlLimits", entity)} } -func (_c *CemOPEVInterface_LoadControlLimits_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOPEVInterface_LoadControlLimits_Call { +func (_c *CemOPEVInterface_LoadControlLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOPEVInterface_LoadControlLimits_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemOPEVInterface_LoadControlLimits_Call) Return(limits []api0.LoadLimitsPhase, resultErr error) *CemOPEVInterface_LoadControlLimits_Call { +func (_c *CemOPEVInterface_LoadControlLimits_Call) Return(limits []api.LoadLimitsPhase, resultErr error) *CemOPEVInterface_LoadControlLimits_Call { _c.Call.Return(limits, resultErr) return _c } -func (_c *CemOPEVInterface_LoadControlLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error)) *CemOPEVInterface_LoadControlLimits_Call { +func (_c *CemOPEVInterface_LoadControlLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error)) *CemOPEVInterface_LoadControlLimits_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *CemOPEVInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api1.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api1.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -453,20 +415,19 @@ func (_c *CemOPEVInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemOPE return _c } -func (_c *CemOPEVInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CemOPEVInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *CemOPEVInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemOPEVInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemOPEVInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CemOPEVInterface_RemoteEntitiesScenarios_Call { +func (_c *CemOPEVInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemOPEVInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *CemOPEVInterface) RemoveUseCase() { + _m.Called() } // CemOPEVInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -496,20 +457,21 @@ func (_c *CemOPEVInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemOPEV return _c } -// SetOperatingState provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) SetOperatingState(failureState bool) error { - ret := _mock.Called(failureState) +// SetOperatingState provides a mock function with given fields: failureState +func (_m *CemOPEVInterface) SetOperatingState(failureState bool) error { + ret := _m.Called(failureState) if len(ret) == 0 { panic("no return value specified for SetOperatingState") } var r0 error - if returnFunc, ok := ret.Get(0).(func(bool) error); ok { - r0 = returnFunc(failureState) + if rf, ok := ret.Get(0).(func(bool) error); ok { + r0 = rf(failureState) } else { r0 = ret.Error(0) } + return r0 } @@ -526,31 +488,24 @@ func (_e *CemOPEVInterface_Expecter) SetOperatingState(failureState interface{}) func (_c *CemOPEVInterface_SetOperatingState_Call) Run(run func(failureState bool)) *CemOPEVInterface_SetOperatingState_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } -func (_c *CemOPEVInterface_SetOperatingState_Call) Return(err error) *CemOPEVInterface_SetOperatingState_Call { - _c.Call.Return(err) +func (_c *CemOPEVInterface_SetOperatingState_Call) Return(_a0 error) *CemOPEVInterface_SetOperatingState_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemOPEVInterface_SetOperatingState_Call) RunAndReturn(run func(failureState bool) error) *CemOPEVInterface_SetOperatingState_Call { +func (_c *CemOPEVInterface_SetOperatingState_Call) RunAndReturn(run func(bool) error) *CemOPEVInterface_SetOperatingState_Call { _c.Call.Return(run) return _c } -// StartHeartbeat provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) StartHeartbeat() { - _mock.Called() - return +// StartHeartbeat provides a mock function with no fields +func (_m *CemOPEVInterface) StartHeartbeat() { + _m.Called() } // CemOPEVInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -580,10 +535,9 @@ func (_c *CemOPEVInterface_StartHeartbeat_Call) RunAndReturn(run func()) *CemOPE return _c } -// StopHeartbeat provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) StopHeartbeat() { - _mock.Called() - return +// StopHeartbeat provides a mock function with no fields +func (_m *CemOPEVInterface) StopHeartbeat() { + _m.Called() } // CemOPEVInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -613,10 +567,9 @@ func (_c *CemOPEVInterface_StopHeartbeat_Call) RunAndReturn(run func()) *CemOPEV return _c } -// UpdateUseCaseAvailability provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *CemOPEVInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // CemOPEVInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -632,13 +585,7 @@ func (_e *CemOPEVInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *CemOPEVInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemOPEVInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -648,14 +595,14 @@ func (_c *CemOPEVInterface_UpdateUseCaseAvailability_Call) Return() *CemOPEVInte return _c } -func (_c *CemOPEVInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemOPEVInterface_UpdateUseCaseAvailability_Call { +func (_c *CemOPEVInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemOPEVInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// WriteLoadControlLimits provides a mock function for the type CemOPEVInterface -func (_mock *CemOPEVInterface) WriteLoadControlLimits(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error) { - ret := _mock.Called(entity, limits, resultCB) +// WriteLoadControlLimits provides a mock function with given fields: entity, limits, resultCB +func (_m *CemOPEVInterface) WriteLoadControlLimits(entity spine_goapi.EntityRemoteInterface, limits []api.LoadLimitsPhase, resultCB func(model.ResultDataType)) (*model.MsgCounterType, error) { + ret := _m.Called(entity, limits, resultCB) if len(ret) == 0 { panic("no return value specified for WriteLoadControlLimits") @@ -663,21 +610,23 @@ func (_mock *CemOPEVInterface) WriteLoadControlLimits(entity api.EntityRemoteInt var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) (*model.MsgCounterType, error)); ok { - return returnFunc(entity, limits, resultCB) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) (*model.MsgCounterType, error)); ok { + return rf(entity, limits, resultCB) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) *model.MsgCounterType); ok { - r0 = returnFunc(entity, limits, resultCB) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) *model.MsgCounterType); ok { + r0 = rf(entity, limits, resultCB) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) error); ok { - r1 = returnFunc(entity, limits, resultCB) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) error); ok { + r1 = rf(entity, limits, resultCB) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -687,42 +636,40 @@ type CemOPEVInterface_WriteLoadControlLimits_Call struct { } // WriteLoadControlLimits is a helper method to define mock.On call -// - entity api.EntityRemoteInterface -// - limits []api0.LoadLimitsPhase -// - resultCB func(result model.ResultDataType) +// - entity spine_goapi.EntityRemoteInterface +// - limits []api.LoadLimitsPhase +// - resultCB func(model.ResultDataType) func (_e *CemOPEVInterface_Expecter) WriteLoadControlLimits(entity interface{}, limits interface{}, resultCB interface{}) *CemOPEVInterface_WriteLoadControlLimits_Call { return &CemOPEVInterface_WriteLoadControlLimits_Call{Call: _e.mock.On("WriteLoadControlLimits", entity, limits, resultCB)} } -func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) Run(run func(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType))) *CemOPEVInterface_WriteLoadControlLimits_Call { +func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, limits []api.LoadLimitsPhase, resultCB func(model.ResultDataType))) *CemOPEVInterface_WriteLoadControlLimits_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 []api0.LoadLimitsPhase - if args[1] != nil { - arg1 = args[1].([]api0.LoadLimitsPhase) - } - var arg2 func(result model.ResultDataType) - if args[2] != nil { - arg2 = args[2].(func(result model.ResultDataType)) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].([]api.LoadLimitsPhase), args[2].(func(model.ResultDataType))) }) return _c } -func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) Return(msgCounterType *model.MsgCounterType, err error) *CemOPEVInterface_WriteLoadControlLimits_Call { - _c.Call.Return(msgCounterType, err) +func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) Return(_a0 *model.MsgCounterType, _a1 error) *CemOPEVInterface_WriteLoadControlLimits_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error)) *CemOPEVInterface_WriteLoadControlLimits_Call { +func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) (*model.MsgCounterType, error)) *CemOPEVInterface_WriteLoadControlLimits_Call { _c.Call.Return(run) return _c } + +// NewCemOPEVInterface creates a new instance of CemOPEVInterface. 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 NewCemOPEVInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemOPEVInterface { + mock := &CemOPEVInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/CemOSCEVInterface.go b/usecases/mocks/CemOSCEVInterface.go index 15abdbd2..9e8ab8a1 100644 --- a/usecases/mocks/CemOSCEVInterface.go +++ b/usecases/mocks/CemOSCEVInterface.go @@ -1,30 +1,17 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api1 "github.com/enbility/eebus-go/api" - api0 "github.com/enbility/eebus-go/usecases/api" - "github.com/enbility/spine-go/api" - "github.com/enbility/spine-go/model" - mock "github.com/stretchr/testify/mock" -) + eebus_goapi "github.com/enbility/eebus-go/api" + api "github.com/enbility/eebus-go/usecases/api" -// NewCemOSCEVInterface creates a new instance of CemOSCEVInterface. 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 NewCemOSCEVInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemOSCEVInterface { - mock := &CemOSCEVInterface{} - mock.Mock.Test(t) + mock "github.com/stretchr/testify/mock" - t.Cleanup(func() { mock.AssertExpectations(t) }) + model "github.com/enbility/spine-go/model" - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // CemOSCEVInterface is an autogenerated mock type for the CemOSCEVInterface type type CemOSCEVInterface struct { @@ -39,20 +26,21 @@ func (_m *CemOSCEVInterface) EXPECT() *CemOSCEVInterface_Expecter { return &CemOSCEVInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *CemOSCEVInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -73,8 +61,8 @@ func (_c *CemOSCEVInterface_AddFeatures_Call) Run(run func()) *CemOSCEVInterface return _c } -func (_c *CemOSCEVInterface_AddFeatures_Call) Return(err error) *CemOSCEVInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *CemOSCEVInterface_AddFeatures_Call) Return(_a0 error) *CemOSCEVInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -83,10 +71,9 @@ func (_c *CemOSCEVInterface_AddFeatures_Call) RunAndReturn(run func() error) *Ce return _c } -// AddUseCase provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *CemOSCEVInterface) AddUseCase() { + _m.Called() } // CemOSCEVInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -116,22 +103,23 @@ func (_c *CemOSCEVInterface_AddUseCase_Call) RunAndReturn(run func()) *CemOSCEVI return _c } -// AvailableScenariosForEntity provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *CemOSCEVInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -141,37 +129,31 @@ type CemOSCEVInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemOSCEVInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemOSCEVInterface_AvailableScenariosForEntity_Call { return &CemOSCEVInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOSCEVInterface_AvailableScenariosForEntity_Call { +func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOSCEVInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemOSCEVInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemOSCEVInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemOSCEVInterface_AvailableScenariosForEntity_Call { +func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemOSCEVInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentLimits provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) CurrentLimits(entity api.EntityRemoteInterface) ([]float64, []float64, []float64, error) { - ret := _mock.Called(entity) +// CurrentLimits provides a mock function with given fields: entity +func (_m *CemOSCEVInterface) CurrentLimits(entity spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for CurrentLimits") @@ -181,35 +163,39 @@ func (_mock *CemOSCEVInterface) CurrentLimits(entity api.EntityRemoteInterface) var r1 []float64 var r2 []float64 var r3 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, []float64, []float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) []float64); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r1 = rf(entity) } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]float64) } } - if returnFunc, ok := ret.Get(2).(func(api.EntityRemoteInterface) []float64); ok { - r2 = returnFunc(entity) + + if rf, ok := ret.Get(2).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r2 = rf(entity) } else { if ret.Get(2) != nil { r2 = ret.Get(2).([]float64) } } - if returnFunc, ok := ret.Get(3).(func(api.EntityRemoteInterface) error); ok { - r3 = returnFunc(entity) + + if rf, ok := ret.Get(3).(func(spine_goapi.EntityRemoteInterface) error); ok { + r3 = rf(entity) } else { r3 = ret.Error(3) } + return r0, r1, r2, r3 } @@ -219,48 +205,43 @@ type CemOSCEVInterface_CurrentLimits_Call struct { } // CurrentLimits is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemOSCEVInterface_Expecter) CurrentLimits(entity interface{}) *CemOSCEVInterface_CurrentLimits_Call { return &CemOSCEVInterface_CurrentLimits_Call{Call: _e.mock.On("CurrentLimits", entity)} } -func (_c *CemOSCEVInterface_CurrentLimits_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOSCEVInterface_CurrentLimits_Call { +func (_c *CemOSCEVInterface_CurrentLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOSCEVInterface_CurrentLimits_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemOSCEVInterface_CurrentLimits_Call) Return(float64s []float64, float64s1 []float64, float64s2 []float64, err error) *CemOSCEVInterface_CurrentLimits_Call { - _c.Call.Return(float64s, float64s1, float64s2, err) +func (_c *CemOSCEVInterface_CurrentLimits_Call) Return(_a0 []float64, _a1 []float64, _a2 []float64, _a3 error) *CemOSCEVInterface_CurrentLimits_Call { + _c.Call.Return(_a0, _a1, _a2, _a3) return _c } -func (_c *CemOSCEVInterface_CurrentLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, []float64, []float64, error)) *CemOSCEVInterface_CurrentLimits_Call { +func (_c *CemOSCEVInterface_CurrentLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error)) *CemOSCEVInterface_CurrentLimits_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *CemOSCEVInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -270,48 +251,43 @@ type CemOSCEVInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemOSCEVInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemOSCEVInterface_IsCompatibleEntityType_Call { return &CemOSCEVInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOSCEVInterface_IsCompatibleEntityType_Call { +func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOSCEVInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) Return(b bool) *CemOSCEVInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemOSCEVInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemOSCEVInterface_IsCompatibleEntityType_Call { +func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemOSCEVInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *CemOSCEVInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -321,65 +297,56 @@ type CemOSCEVInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *CemOSCEVInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { return &CemOSCEVInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// LoadControlLimits provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) LoadControlLimits(entity api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error) { - ret := _mock.Called(entity) +// LoadControlLimits provides a mock function with given fields: entity +func (_m *CemOSCEVInterface) LoadControlLimits(entity spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for LoadControlLimits") } - var r0 []api0.LoadLimitsPhase + var r0 []api.LoadLimitsPhase var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []api0.LoadLimitsPhase); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []api.LoadLimitsPhase); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.LoadLimitsPhase) + r0 = ret.Get(0).([]api.LoadLimitsPhase) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -389,50 +356,45 @@ type CemOSCEVInterface_LoadControlLimits_Call struct { } // LoadControlLimits is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemOSCEVInterface_Expecter) LoadControlLimits(entity interface{}) *CemOSCEVInterface_LoadControlLimits_Call { return &CemOSCEVInterface_LoadControlLimits_Call{Call: _e.mock.On("LoadControlLimits", entity)} } -func (_c *CemOSCEVInterface_LoadControlLimits_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOSCEVInterface_LoadControlLimits_Call { +func (_c *CemOSCEVInterface_LoadControlLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOSCEVInterface_LoadControlLimits_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemOSCEVInterface_LoadControlLimits_Call) Return(limits []api0.LoadLimitsPhase, resultErr error) *CemOSCEVInterface_LoadControlLimits_Call { +func (_c *CemOSCEVInterface_LoadControlLimits_Call) Return(limits []api.LoadLimitsPhase, resultErr error) *CemOSCEVInterface_LoadControlLimits_Call { _c.Call.Return(limits, resultErr) return _c } -func (_c *CemOSCEVInterface_LoadControlLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error)) *CemOSCEVInterface_LoadControlLimits_Call { +func (_c *CemOSCEVInterface_LoadControlLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error)) *CemOSCEVInterface_LoadControlLimits_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *CemOSCEVInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api1.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api1.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -453,20 +415,19 @@ func (_c *CemOSCEVInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemOS return _c } -func (_c *CemOSCEVInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CemOSCEVInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *CemOSCEVInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemOSCEVInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemOSCEVInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CemOSCEVInterface_RemoteEntitiesScenarios_Call { +func (_c *CemOSCEVInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemOSCEVInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *CemOSCEVInterface) RemoveUseCase() { + _m.Called() } // CemOSCEVInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -496,20 +457,21 @@ func (_c *CemOSCEVInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemOSC return _c } -// SetOperatingState provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) SetOperatingState(failureState bool) error { - ret := _mock.Called(failureState) +// SetOperatingState provides a mock function with given fields: failureState +func (_m *CemOSCEVInterface) SetOperatingState(failureState bool) error { + ret := _m.Called(failureState) if len(ret) == 0 { panic("no return value specified for SetOperatingState") } var r0 error - if returnFunc, ok := ret.Get(0).(func(bool) error); ok { - r0 = returnFunc(failureState) + if rf, ok := ret.Get(0).(func(bool) error); ok { + r0 = rf(failureState) } else { r0 = ret.Error(0) } + return r0 } @@ -526,31 +488,24 @@ func (_e *CemOSCEVInterface_Expecter) SetOperatingState(failureState interface{} func (_c *CemOSCEVInterface_SetOperatingState_Call) Run(run func(failureState bool)) *CemOSCEVInterface_SetOperatingState_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } -func (_c *CemOSCEVInterface_SetOperatingState_Call) Return(err error) *CemOSCEVInterface_SetOperatingState_Call { - _c.Call.Return(err) +func (_c *CemOSCEVInterface_SetOperatingState_Call) Return(_a0 error) *CemOSCEVInterface_SetOperatingState_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemOSCEVInterface_SetOperatingState_Call) RunAndReturn(run func(failureState bool) error) *CemOSCEVInterface_SetOperatingState_Call { +func (_c *CemOSCEVInterface_SetOperatingState_Call) RunAndReturn(run func(bool) error) *CemOSCEVInterface_SetOperatingState_Call { _c.Call.Return(run) return _c } -// StartHeartbeat provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) StartHeartbeat() { - _mock.Called() - return +// StartHeartbeat provides a mock function with no fields +func (_m *CemOSCEVInterface) StartHeartbeat() { + _m.Called() } // CemOSCEVInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -580,10 +535,9 @@ func (_c *CemOSCEVInterface_StartHeartbeat_Call) RunAndReturn(run func()) *CemOS return _c } -// StopHeartbeat provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) StopHeartbeat() { - _mock.Called() - return +// StopHeartbeat provides a mock function with no fields +func (_m *CemOSCEVInterface) StopHeartbeat() { + _m.Called() } // CemOSCEVInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -613,10 +567,9 @@ func (_c *CemOSCEVInterface_StopHeartbeat_Call) RunAndReturn(run func()) *CemOSC return _c } -// UpdateUseCaseAvailability provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *CemOSCEVInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // CemOSCEVInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -632,13 +585,7 @@ func (_e *CemOSCEVInterface_Expecter) UpdateUseCaseAvailability(available interf func (_c *CemOSCEVInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemOSCEVInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -648,14 +595,14 @@ func (_c *CemOSCEVInterface_UpdateUseCaseAvailability_Call) Return() *CemOSCEVIn return _c } -func (_c *CemOSCEVInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemOSCEVInterface_UpdateUseCaseAvailability_Call { +func (_c *CemOSCEVInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemOSCEVInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// WriteLoadControlLimits provides a mock function for the type CemOSCEVInterface -func (_mock *CemOSCEVInterface) WriteLoadControlLimits(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error) { - ret := _mock.Called(entity, limits, resultCB) +// WriteLoadControlLimits provides a mock function with given fields: entity, limits, resultCB +func (_m *CemOSCEVInterface) WriteLoadControlLimits(entity spine_goapi.EntityRemoteInterface, limits []api.LoadLimitsPhase, resultCB func(model.ResultDataType)) (*model.MsgCounterType, error) { + ret := _m.Called(entity, limits, resultCB) if len(ret) == 0 { panic("no return value specified for WriteLoadControlLimits") @@ -663,21 +610,23 @@ func (_mock *CemOSCEVInterface) WriteLoadControlLimits(entity api.EntityRemoteIn var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) (*model.MsgCounterType, error)); ok { - return returnFunc(entity, limits, resultCB) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) (*model.MsgCounterType, error)); ok { + return rf(entity, limits, resultCB) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) *model.MsgCounterType); ok { - r0 = returnFunc(entity, limits, resultCB) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) *model.MsgCounterType); ok { + r0 = rf(entity, limits, resultCB) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) error); ok { - r1 = returnFunc(entity, limits, resultCB) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) error); ok { + r1 = rf(entity, limits, resultCB) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -687,42 +636,40 @@ type CemOSCEVInterface_WriteLoadControlLimits_Call struct { } // WriteLoadControlLimits is a helper method to define mock.On call -// - entity api.EntityRemoteInterface -// - limits []api0.LoadLimitsPhase -// - resultCB func(result model.ResultDataType) +// - entity spine_goapi.EntityRemoteInterface +// - limits []api.LoadLimitsPhase +// - resultCB func(model.ResultDataType) func (_e *CemOSCEVInterface_Expecter) WriteLoadControlLimits(entity interface{}, limits interface{}, resultCB interface{}) *CemOSCEVInterface_WriteLoadControlLimits_Call { return &CemOSCEVInterface_WriteLoadControlLimits_Call{Call: _e.mock.On("WriteLoadControlLimits", entity, limits, resultCB)} } -func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) Run(run func(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType))) *CemOSCEVInterface_WriteLoadControlLimits_Call { +func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, limits []api.LoadLimitsPhase, resultCB func(model.ResultDataType))) *CemOSCEVInterface_WriteLoadControlLimits_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 []api0.LoadLimitsPhase - if args[1] != nil { - arg1 = args[1].([]api0.LoadLimitsPhase) - } - var arg2 func(result model.ResultDataType) - if args[2] != nil { - arg2 = args[2].(func(result model.ResultDataType)) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].([]api.LoadLimitsPhase), args[2].(func(model.ResultDataType))) }) return _c } -func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) Return(msgCounterType *model.MsgCounterType, err error) *CemOSCEVInterface_WriteLoadControlLimits_Call { - _c.Call.Return(msgCounterType, err) +func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) Return(_a0 *model.MsgCounterType, _a1 error) *CemOSCEVInterface_WriteLoadControlLimits_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error)) *CemOSCEVInterface_WriteLoadControlLimits_Call { +func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) (*model.MsgCounterType, error)) *CemOSCEVInterface_WriteLoadControlLimits_Call { _c.Call.Return(run) return _c } + +// NewCemOSCEVInterface creates a new instance of CemOSCEVInterface. 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 NewCemOSCEVInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemOSCEVInterface { + mock := &CemOSCEVInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/CemVABDInterface.go b/usecases/mocks/CemVABDInterface.go index 0d14200a..5f55973c 100644 --- a/usecases/mocks/CemVABDInterface.go +++ b/usecases/mocks/CemVABDInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api0 "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/api" + eebus_goapi "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) -// NewCemVABDInterface creates a new instance of CemVABDInterface. 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 NewCemVABDInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemVABDInterface { - mock := &CemVABDInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // CemVABDInterface is an autogenerated mock type for the CemVABDInterface type type CemVABDInterface struct { @@ -37,20 +22,21 @@ func (_m *CemVABDInterface) EXPECT() *CemVABDInterface_Expecter { return &CemVABDInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *CemVABDInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -71,8 +57,8 @@ func (_c *CemVABDInterface_AddFeatures_Call) Run(run func()) *CemVABDInterface_A return _c } -func (_c *CemVABDInterface_AddFeatures_Call) Return(err error) *CemVABDInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *CemVABDInterface_AddFeatures_Call) Return(_a0 error) *CemVABDInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -81,10 +67,9 @@ func (_c *CemVABDInterface_AddFeatures_Call) RunAndReturn(run func() error) *Cem return _c } -// AddUseCase provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *CemVABDInterface) AddUseCase() { + _m.Called() } // CemVABDInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -114,22 +99,23 @@ func (_c *CemVABDInterface_AddUseCase_Call) RunAndReturn(run func()) *CemVABDInt return _c } -// AvailableScenariosForEntity provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *CemVABDInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -139,37 +125,31 @@ type CemVABDInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemVABDInterface_AvailableScenariosForEntity_Call { return &CemVABDInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_AvailableScenariosForEntity_Call { +func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemVABDInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemVABDInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemVABDInterface_AvailableScenariosForEntity_Call { +func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemVABDInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// EnergyCharged provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) EnergyCharged(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// EnergyCharged provides a mock function with given fields: entity +func (_m *CemVABDInterface) EnergyCharged(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyCharged") @@ -177,19 +157,21 @@ func (_mock *CemVABDInterface) EnergyCharged(entity api.EntityRemoteInterface) ( var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -199,37 +181,31 @@ type CemVABDInterface_EnergyCharged_Call struct { } // EnergyCharged is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) EnergyCharged(entity interface{}) *CemVABDInterface_EnergyCharged_Call { return &CemVABDInterface_EnergyCharged_Call{Call: _e.mock.On("EnergyCharged", entity)} } -func (_c *CemVABDInterface_EnergyCharged_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_EnergyCharged_Call { +func (_c *CemVABDInterface_EnergyCharged_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_EnergyCharged_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemVABDInterface_EnergyCharged_Call) Return(f float64, err error) *CemVABDInterface_EnergyCharged_Call { - _c.Call.Return(f, err) +func (_c *CemVABDInterface_EnergyCharged_Call) Return(_a0 float64, _a1 error) *CemVABDInterface_EnergyCharged_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemVABDInterface_EnergyCharged_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVABDInterface_EnergyCharged_Call { +func (_c *CemVABDInterface_EnergyCharged_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVABDInterface_EnergyCharged_Call { _c.Call.Return(run) return _c } -// EnergyDischarged provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) EnergyDischarged(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// EnergyDischarged provides a mock function with given fields: entity +func (_m *CemVABDInterface) EnergyDischarged(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyDischarged") @@ -237,19 +213,21 @@ func (_mock *CemVABDInterface) EnergyDischarged(entity api.EntityRemoteInterface var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -259,48 +237,43 @@ type CemVABDInterface_EnergyDischarged_Call struct { } // EnergyDischarged is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) EnergyDischarged(entity interface{}) *CemVABDInterface_EnergyDischarged_Call { return &CemVABDInterface_EnergyDischarged_Call{Call: _e.mock.On("EnergyDischarged", entity)} } -func (_c *CemVABDInterface_EnergyDischarged_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_EnergyDischarged_Call { +func (_c *CemVABDInterface_EnergyDischarged_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_EnergyDischarged_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemVABDInterface_EnergyDischarged_Call) Return(f float64, err error) *CemVABDInterface_EnergyDischarged_Call { - _c.Call.Return(f, err) +func (_c *CemVABDInterface_EnergyDischarged_Call) Return(_a0 float64, _a1 error) *CemVABDInterface_EnergyDischarged_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemVABDInterface_EnergyDischarged_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVABDInterface_EnergyDischarged_Call { +func (_c *CemVABDInterface_EnergyDischarged_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVABDInterface_EnergyDischarged_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *CemVABDInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -310,48 +283,43 @@ type CemVABDInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemVABDInterface_IsCompatibleEntityType_Call { return &CemVABDInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemVABDInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_IsCompatibleEntityType_Call { +func (_c *CemVABDInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemVABDInterface_IsCompatibleEntityType_Call) Return(b bool) *CemVABDInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *CemVABDInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemVABDInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemVABDInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemVABDInterface_IsCompatibleEntityType_Call { +func (_c *CemVABDInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemVABDInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *CemVABDInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -361,43 +329,32 @@ type CemVABDInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *CemVABDInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { return &CemVABDInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// Power provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) Power(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// Power provides a mock function with given fields: entity +func (_m *CemVABDInterface) Power(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for Power") @@ -405,19 +362,21 @@ func (_mock *CemVABDInterface) Power(entity api.EntityRemoteInterface) (float64, var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -427,50 +386,45 @@ type CemVABDInterface_Power_Call struct { } // Power is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) Power(entity interface{}) *CemVABDInterface_Power_Call { return &CemVABDInterface_Power_Call{Call: _e.mock.On("Power", entity)} } -func (_c *CemVABDInterface_Power_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_Power_Call { +func (_c *CemVABDInterface_Power_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_Power_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemVABDInterface_Power_Call) Return(f float64, err error) *CemVABDInterface_Power_Call { - _c.Call.Return(f, err) +func (_c *CemVABDInterface_Power_Call) Return(_a0 float64, _a1 error) *CemVABDInterface_Power_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemVABDInterface_Power_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVABDInterface_Power_Call { +func (_c *CemVABDInterface_Power_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVABDInterface_Power_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *CemVABDInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api0.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -491,20 +445,19 @@ func (_c *CemVABDInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemVAB return _c } -func (_c *CemVABDInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *CemVABDInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *CemVABDInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemVABDInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemVABDInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *CemVABDInterface_RemoteEntitiesScenarios_Call { +func (_c *CemVABDInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemVABDInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *CemVABDInterface) RemoveUseCase() { + _m.Called() } // CemVABDInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -534,9 +487,9 @@ func (_c *CemVABDInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemVABD return _c } -// StateOfCharge provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) StateOfCharge(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// StateOfCharge provides a mock function with given fields: entity +func (_m *CemVABDInterface) StateOfCharge(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for StateOfCharge") @@ -544,19 +497,21 @@ func (_mock *CemVABDInterface) StateOfCharge(entity api.EntityRemoteInterface) ( var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -566,38 +521,31 @@ type CemVABDInterface_StateOfCharge_Call struct { } // StateOfCharge is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) StateOfCharge(entity interface{}) *CemVABDInterface_StateOfCharge_Call { return &CemVABDInterface_StateOfCharge_Call{Call: _e.mock.On("StateOfCharge", entity)} } -func (_c *CemVABDInterface_StateOfCharge_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_StateOfCharge_Call { +func (_c *CemVABDInterface_StateOfCharge_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_StateOfCharge_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemVABDInterface_StateOfCharge_Call) Return(f float64, err error) *CemVABDInterface_StateOfCharge_Call { - _c.Call.Return(f, err) +func (_c *CemVABDInterface_StateOfCharge_Call) Return(_a0 float64, _a1 error) *CemVABDInterface_StateOfCharge_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemVABDInterface_StateOfCharge_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVABDInterface_StateOfCharge_Call { +func (_c *CemVABDInterface_StateOfCharge_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVABDInterface_StateOfCharge_Call { _c.Call.Return(run) return _c } -// UpdateUseCaseAvailability provides a mock function for the type CemVABDInterface -func (_mock *CemVABDInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *CemVABDInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // CemVABDInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -613,13 +561,7 @@ func (_e *CemVABDInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *CemVABDInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemVABDInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -629,7 +571,21 @@ func (_c *CemVABDInterface_UpdateUseCaseAvailability_Call) Return() *CemVABDInte return _c } -func (_c *CemVABDInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemVABDInterface_UpdateUseCaseAvailability_Call { +func (_c *CemVABDInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemVABDInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } + +// NewCemVABDInterface creates a new instance of CemVABDInterface. 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 NewCemVABDInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemVABDInterface { + mock := &CemVABDInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/CemVAPDInterface.go b/usecases/mocks/CemVAPDInterface.go index a9b2d65d..2bac0b59 100644 --- a/usecases/mocks/CemVAPDInterface.go +++ b/usecases/mocks/CemVAPDInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api0 "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/api" + eebus_goapi "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) - -// NewCemVAPDInterface creates a new instance of CemVAPDInterface. 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 NewCemVAPDInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemVAPDInterface { - mock := &CemVAPDInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // CemVAPDInterface is an autogenerated mock type for the CemVAPDInterface type type CemVAPDInterface struct { @@ -37,20 +22,21 @@ func (_m *CemVAPDInterface) EXPECT() *CemVAPDInterface_Expecter { return &CemVAPDInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *CemVAPDInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -71,8 +57,8 @@ func (_c *CemVAPDInterface_AddFeatures_Call) Run(run func()) *CemVAPDInterface_A return _c } -func (_c *CemVAPDInterface_AddFeatures_Call) Return(err error) *CemVAPDInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *CemVAPDInterface_AddFeatures_Call) Return(_a0 error) *CemVAPDInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -81,10 +67,9 @@ func (_c *CemVAPDInterface_AddFeatures_Call) RunAndReturn(run func() error) *Cem return _c } -// AddUseCase provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *CemVAPDInterface) AddUseCase() { + _m.Called() } // CemVAPDInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -114,22 +99,23 @@ func (_c *CemVAPDInterface_AddUseCase_Call) RunAndReturn(run func()) *CemVAPDInt return _c } -// AvailableScenariosForEntity provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *CemVAPDInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -139,48 +125,43 @@ type CemVAPDInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemVAPDInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemVAPDInterface_AvailableScenariosForEntity_Call { return &CemVAPDInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVAPDInterface_AvailableScenariosForEntity_Call { +func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVAPDInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemVAPDInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemVAPDInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemVAPDInterface_AvailableScenariosForEntity_Call { +func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemVAPDInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *CemVAPDInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -190,48 +171,43 @@ type CemVAPDInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemVAPDInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemVAPDInterface_IsCompatibleEntityType_Call { return &CemVAPDInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVAPDInterface_IsCompatibleEntityType_Call { +func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVAPDInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) Return(b bool) *CemVAPDInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemVAPDInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemVAPDInterface_IsCompatibleEntityType_Call { +func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemVAPDInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *CemVAPDInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -241,43 +217,32 @@ type CemVAPDInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *CemVAPDInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { return &CemVAPDInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// PVYieldTotal provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) PVYieldTotal(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// PVYieldTotal provides a mock function with given fields: entity +func (_m *CemVAPDInterface) PVYieldTotal(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for PVYieldTotal") @@ -285,19 +250,21 @@ func (_mock *CemVAPDInterface) PVYieldTotal(entity api.EntityRemoteInterface) (f var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -307,37 +274,31 @@ type CemVAPDInterface_PVYieldTotal_Call struct { } // PVYieldTotal is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemVAPDInterface_Expecter) PVYieldTotal(entity interface{}) *CemVAPDInterface_PVYieldTotal_Call { return &CemVAPDInterface_PVYieldTotal_Call{Call: _e.mock.On("PVYieldTotal", entity)} } -func (_c *CemVAPDInterface_PVYieldTotal_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVAPDInterface_PVYieldTotal_Call { +func (_c *CemVAPDInterface_PVYieldTotal_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVAPDInterface_PVYieldTotal_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemVAPDInterface_PVYieldTotal_Call) Return(f float64, err error) *CemVAPDInterface_PVYieldTotal_Call { - _c.Call.Return(f, err) +func (_c *CemVAPDInterface_PVYieldTotal_Call) Return(_a0 float64, _a1 error) *CemVAPDInterface_PVYieldTotal_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemVAPDInterface_PVYieldTotal_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_PVYieldTotal_Call { +func (_c *CemVAPDInterface_PVYieldTotal_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_PVYieldTotal_Call { _c.Call.Return(run) return _c } -// Power provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) Power(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// Power provides a mock function with given fields: entity +func (_m *CemVAPDInterface) Power(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for Power") @@ -345,19 +306,21 @@ func (_mock *CemVAPDInterface) Power(entity api.EntityRemoteInterface) (float64, var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -367,37 +330,31 @@ type CemVAPDInterface_Power_Call struct { } // Power is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemVAPDInterface_Expecter) Power(entity interface{}) *CemVAPDInterface_Power_Call { return &CemVAPDInterface_Power_Call{Call: _e.mock.On("Power", entity)} } -func (_c *CemVAPDInterface_Power_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVAPDInterface_Power_Call { +func (_c *CemVAPDInterface_Power_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVAPDInterface_Power_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemVAPDInterface_Power_Call) Return(f float64, err error) *CemVAPDInterface_Power_Call { - _c.Call.Return(f, err) +func (_c *CemVAPDInterface_Power_Call) Return(_a0 float64, _a1 error) *CemVAPDInterface_Power_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemVAPDInterface_Power_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_Power_Call { +func (_c *CemVAPDInterface_Power_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_Power_Call { _c.Call.Return(run) return _c } -// PowerNominalPeak provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) PowerNominalPeak(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// PowerNominalPeak provides a mock function with given fields: entity +func (_m *CemVAPDInterface) PowerNominalPeak(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for PowerNominalPeak") @@ -405,19 +362,21 @@ func (_mock *CemVAPDInterface) PowerNominalPeak(entity api.EntityRemoteInterface var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -427,50 +386,45 @@ type CemVAPDInterface_PowerNominalPeak_Call struct { } // PowerNominalPeak is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CemVAPDInterface_Expecter) PowerNominalPeak(entity interface{}) *CemVAPDInterface_PowerNominalPeak_Call { return &CemVAPDInterface_PowerNominalPeak_Call{Call: _e.mock.On("PowerNominalPeak", entity)} } -func (_c *CemVAPDInterface_PowerNominalPeak_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVAPDInterface_PowerNominalPeak_Call { +func (_c *CemVAPDInterface_PowerNominalPeak_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVAPDInterface_PowerNominalPeak_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CemVAPDInterface_PowerNominalPeak_Call) Return(f float64, err error) *CemVAPDInterface_PowerNominalPeak_Call { - _c.Call.Return(f, err) +func (_c *CemVAPDInterface_PowerNominalPeak_Call) Return(_a0 float64, _a1 error) *CemVAPDInterface_PowerNominalPeak_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CemVAPDInterface_PowerNominalPeak_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_PowerNominalPeak_Call { +func (_c *CemVAPDInterface_PowerNominalPeak_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_PowerNominalPeak_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *CemVAPDInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api0.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -491,20 +445,19 @@ func (_c *CemVAPDInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemVAP return _c } -func (_c *CemVAPDInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *CemVAPDInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *CemVAPDInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemVAPDInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *CemVAPDInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *CemVAPDInterface_RemoteEntitiesScenarios_Call { +func (_c *CemVAPDInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemVAPDInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *CemVAPDInterface) RemoveUseCase() { + _m.Called() } // CemVAPDInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -534,10 +487,9 @@ func (_c *CemVAPDInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemVAPD return _c } -// UpdateUseCaseAvailability provides a mock function for the type CemVAPDInterface -func (_mock *CemVAPDInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *CemVAPDInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // CemVAPDInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -553,13 +505,7 @@ func (_e *CemVAPDInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *CemVAPDInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemVAPDInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -569,7 +515,21 @@ func (_c *CemVAPDInterface_UpdateUseCaseAvailability_Call) Return() *CemVAPDInte return _c } -func (_c *CemVAPDInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemVAPDInterface_UpdateUseCaseAvailability_Call { +func (_c *CemVAPDInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemVAPDInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } + +// NewCemVAPDInterface creates a new instance of CemVAPDInterface. 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 NewCemVAPDInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemVAPDInterface { + mock := &CemVAPDInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/CsLPCInterface.go b/usecases/mocks/CsLPCInterface.go index f65c21fd..0da91277 100644 --- a/usecases/mocks/CsLPCInterface.go +++ b/usecases/mocks/CsLPCInterface.go @@ -1,32 +1,19 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "time" + eebus_goapi "github.com/enbility/eebus-go/api" + api "github.com/enbility/eebus-go/usecases/api" - api1 "github.com/enbility/eebus-go/api" - api0 "github.com/enbility/eebus-go/usecases/api" - "github.com/enbility/spine-go/api" - "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" -) -// NewCsLPCInterface creates a new instance of CsLPCInterface. 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 NewCsLPCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CsLPCInterface { - mock := &CsLPCInterface{} - mock.Mock.Test(t) + model "github.com/enbility/spine-go/model" - t.Cleanup(func() { mock.AssertExpectations(t) }) + spine_goapi "github.com/enbility/spine-go/api" - return mock -} + time "time" +) // CsLPCInterface is an autogenerated mock type for the CsLPCInterface type type CsLPCInterface struct { @@ -41,20 +28,21 @@ func (_m *CsLPCInterface) EXPECT() *CsLPCInterface_Expecter { return &CsLPCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *CsLPCInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -75,8 +63,8 @@ func (_c *CsLPCInterface_AddFeatures_Call) Run(run func()) *CsLPCInterface_AddFe return _c } -func (_c *CsLPCInterface_AddFeatures_Call) Return(err error) *CsLPCInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *CsLPCInterface_AddFeatures_Call) Return(_a0 error) *CsLPCInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -85,10 +73,9 @@ func (_c *CsLPCInterface_AddFeatures_Call) RunAndReturn(run func() error) *CsLPC return _c } -// AddUseCase provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *CsLPCInterface) AddUseCase() { + _m.Called() } // CsLPCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -118,10 +105,9 @@ func (_c *CsLPCInterface_AddUseCase_Call) RunAndReturn(run func()) *CsLPCInterfa return _c } -// ApproveOrDenyConsumptionLimit provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) ApproveOrDenyConsumptionLimit(msgCounter model.MsgCounterType, approve bool, reason string) { - _mock.Called(msgCounter, approve, reason) - return +// ApproveOrDenyConsumptionLimit provides a mock function with given fields: msgCounter, approve, reason +func (_m *CsLPCInterface) ApproveOrDenyConsumptionLimit(msgCounter model.MsgCounterType, approve bool, reason string) { + _m.Called(msgCounter, approve, reason) } // CsLPCInterface_ApproveOrDenyConsumptionLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApproveOrDenyConsumptionLimit' @@ -139,23 +125,7 @@ func (_e *CsLPCInterface_Expecter) ApproveOrDenyConsumptionLimit(msgCounter inte func (_c *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call) Run(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.MsgCounterType - if args[0] != nil { - arg0 = args[0].(model.MsgCounterType) - } - var arg1 bool - if args[1] != nil { - arg1 = args[1].(bool) - } - var arg2 string - if args[2] != nil { - arg2 = args[2].(string) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(model.MsgCounterType), args[1].(bool), args[2].(string)) }) return _c } @@ -165,27 +135,28 @@ func (_c *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call) Return() *CsLPCInte return _c } -func (_c *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call) RunAndReturn(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call { +func (_c *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call) RunAndReturn(run func(model.MsgCounterType, bool, string)) *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call { _c.Run(run) return _c } -// AvailableScenariosForEntity provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *CsLPCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -195,57 +166,53 @@ type CsLPCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CsLPCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CsLPCInterface_AvailableScenariosForEntity_Call { return &CsLPCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CsLPCInterface_AvailableScenariosForEntity_Call { +func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CsLPCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CsLPCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CsLPCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CsLPCInterface_AvailableScenariosForEntity_Call { +func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CsLPCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// ConsumptionLimit provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) ConsumptionLimit() (api0.LoadLimit, error) { - ret := _mock.Called() +// ConsumptionLimit provides a mock function with no fields +func (_m *CsLPCInterface) ConsumptionLimit() (api.LoadLimit, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for ConsumptionLimit") } - var r0 api0.LoadLimit + var r0 api.LoadLimit var r1 error - if returnFunc, ok := ret.Get(0).(func() (api0.LoadLimit, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (api.LoadLimit, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() api0.LoadLimit); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() api.LoadLimit); ok { + r0 = rf() } else { - r0 = ret.Get(0).(api0.LoadLimit) + r0 = ret.Get(0).(api.LoadLimit) } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -266,19 +233,19 @@ func (_c *CsLPCInterface_ConsumptionLimit_Call) Run(run func()) *CsLPCInterface_ return _c } -func (_c *CsLPCInterface_ConsumptionLimit_Call) Return(loadLimit api0.LoadLimit, err error) *CsLPCInterface_ConsumptionLimit_Call { - _c.Call.Return(loadLimit, err) +func (_c *CsLPCInterface_ConsumptionLimit_Call) Return(_a0 api.LoadLimit, _a1 error) *CsLPCInterface_ConsumptionLimit_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CsLPCInterface_ConsumptionLimit_Call) RunAndReturn(run func() (api0.LoadLimit, error)) *CsLPCInterface_ConsumptionLimit_Call { +func (_c *CsLPCInterface_ConsumptionLimit_Call) RunAndReturn(run func() (api.LoadLimit, error)) *CsLPCInterface_ConsumptionLimit_Call { _c.Call.Return(run) return _c } -// ConsumptionNominalMax provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) ConsumptionNominalMax() (float64, error) { - ret := _mock.Called() +// ConsumptionNominalMax provides a mock function with no fields +func (_m *CsLPCInterface) ConsumptionNominalMax() (float64, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for ConsumptionNominalMax") @@ -286,19 +253,21 @@ func (_mock *CsLPCInterface) ConsumptionNominalMax() (float64, error) { var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (float64, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() float64); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() float64); ok { + r0 = rf() } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -319,8 +288,8 @@ func (_c *CsLPCInterface_ConsumptionNominalMax_Call) Run(run func()) *CsLPCInter return _c } -func (_c *CsLPCInterface_ConsumptionNominalMax_Call) Return(f float64, err error) *CsLPCInterface_ConsumptionNominalMax_Call { - _c.Call.Return(f, err) +func (_c *CsLPCInterface_ConsumptionNominalMax_Call) Return(_a0 float64, _a1 error) *CsLPCInterface_ConsumptionNominalMax_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -329,9 +298,9 @@ func (_c *CsLPCInterface_ConsumptionNominalMax_Call) RunAndReturn(run func() (fl return _c } -// FailsafeConsumptionActivePowerLimit provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) FailsafeConsumptionActivePowerLimit() (float64, bool, error) { - ret := _mock.Called() +// FailsafeConsumptionActivePowerLimit provides a mock function with no fields +func (_m *CsLPCInterface) FailsafeConsumptionActivePowerLimit() (float64, bool, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for FailsafeConsumptionActivePowerLimit") @@ -340,24 +309,27 @@ func (_mock *CsLPCInterface) FailsafeConsumptionActivePowerLimit() (float64, boo var r0 float64 var r1 bool var r2 error - if returnFunc, ok := ret.Get(0).(func() (float64, bool, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (float64, bool, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() float64); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() float64); ok { + r0 = rf() } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func() bool); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() bool); ok { + r1 = rf() } else { r1 = ret.Get(1).(bool) } - if returnFunc, ok := ret.Get(2).(func() error); ok { - r2 = returnFunc() + + if rf, ok := ret.Get(2).(func() error); ok { + r2 = rf() } else { r2 = ret.Error(2) } + return r0, r1, r2 } @@ -388,9 +360,9 @@ func (_c *CsLPCInterface_FailsafeConsumptionActivePowerLimit_Call) RunAndReturn( return _c } -// FailsafeDurationMinimum provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) FailsafeDurationMinimum() (time.Duration, bool, error) { - ret := _mock.Called() +// FailsafeDurationMinimum provides a mock function with no fields +func (_m *CsLPCInterface) FailsafeDurationMinimum() (time.Duration, bool, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for FailsafeDurationMinimum") @@ -399,24 +371,27 @@ func (_mock *CsLPCInterface) FailsafeDurationMinimum() (time.Duration, bool, err var r0 time.Duration var r1 bool var r2 error - if returnFunc, ok := ret.Get(0).(func() (time.Duration, bool, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (time.Duration, bool, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() time.Duration); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() time.Duration); ok { + r0 = rf() } else { r0 = ret.Get(0).(time.Duration) } - if returnFunc, ok := ret.Get(1).(func() bool); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() bool); ok { + r1 = rf() } else { r1 = ret.Get(1).(bool) } - if returnFunc, ok := ret.Get(2).(func() error); ok { - r2 = returnFunc() + + if rf, ok := ret.Get(2).(func() error); ok { + r2 = rf() } else { r2 = ret.Error(2) } + return r0, r1, r2 } @@ -447,20 +422,21 @@ func (_c *CsLPCInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func() ( return _c } -// IsCompatibleEntityType provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *CsLPCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -470,48 +446,43 @@ type CsLPCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CsLPCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CsLPCInterface_IsCompatibleEntityType_Call { return &CsLPCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CsLPCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CsLPCInterface_IsCompatibleEntityType_Call { +func (_c *CsLPCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CsLPCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CsLPCInterface_IsCompatibleEntityType_Call) Return(b bool) *CsLPCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *CsLPCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CsLPCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *CsLPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CsLPCInterface_IsCompatibleEntityType_Call { +func (_c *CsLPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CsLPCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsHeartbeatWithinDuration provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) IsHeartbeatWithinDuration() bool { - ret := _mock.Called() +// IsHeartbeatWithinDuration provides a mock function with no fields +func (_m *CsLPCInterface) IsHeartbeatWithinDuration() bool { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for IsHeartbeatWithinDuration") } var r0 bool - if returnFunc, ok := ret.Get(0).(func() bool); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -532,8 +503,8 @@ func (_c *CsLPCInterface_IsHeartbeatWithinDuration_Call) Run(run func()) *CsLPCI return _c } -func (_c *CsLPCInterface_IsHeartbeatWithinDuration_Call) Return(b bool) *CsLPCInterface_IsHeartbeatWithinDuration_Call { - _c.Call.Return(b) +func (_c *CsLPCInterface_IsHeartbeatWithinDuration_Call) Return(_a0 bool) *CsLPCInterface_IsHeartbeatWithinDuration_Call { + _c.Call.Return(_a0) return _c } @@ -542,20 +513,21 @@ func (_c *CsLPCInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func() return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *CsLPCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -565,56 +537,46 @@ type CsLPCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *CsLPCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { return &CsLPCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// PendingConsumptionLimits provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) PendingConsumptionLimits() map[model.MsgCounterType]api0.LoadLimit { - ret := _mock.Called() +// PendingConsumptionLimits provides a mock function with no fields +func (_m *CsLPCInterface) PendingConsumptionLimits() map[model.MsgCounterType]api.LoadLimit { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for PendingConsumptionLimits") } - var r0 map[model.MsgCounterType]api0.LoadLimit - if returnFunc, ok := ret.Get(0).(func() map[model.MsgCounterType]api0.LoadLimit); ok { - r0 = returnFunc() + var r0 map[model.MsgCounterType]api.LoadLimit + if rf, ok := ret.Get(0).(func() map[model.MsgCounterType]api.LoadLimit); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[model.MsgCounterType]api0.LoadLimit) + r0 = ret.Get(0).(map[model.MsgCounterType]api.LoadLimit) } } + return r0 } @@ -635,32 +597,33 @@ func (_c *CsLPCInterface_PendingConsumptionLimits_Call) Run(run func()) *CsLPCIn return _c } -func (_c *CsLPCInterface_PendingConsumptionLimits_Call) Return(msgCounterTypeToLoadLimit map[model.MsgCounterType]api0.LoadLimit) *CsLPCInterface_PendingConsumptionLimits_Call { - _c.Call.Return(msgCounterTypeToLoadLimit) +func (_c *CsLPCInterface_PendingConsumptionLimits_Call) Return(_a0 map[model.MsgCounterType]api.LoadLimit) *CsLPCInterface_PendingConsumptionLimits_Call { + _c.Call.Return(_a0) return _c } -func (_c *CsLPCInterface_PendingConsumptionLimits_Call) RunAndReturn(run func() map[model.MsgCounterType]api0.LoadLimit) *CsLPCInterface_PendingConsumptionLimits_Call { +func (_c *CsLPCInterface_PendingConsumptionLimits_Call) RunAndReturn(run func() map[model.MsgCounterType]api.LoadLimit) *CsLPCInterface_PendingConsumptionLimits_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *CsLPCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api1.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api1.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -681,20 +644,19 @@ func (_c *CsLPCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CsLPCInt return _c } -func (_c *CsLPCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CsLPCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *CsLPCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CsLPCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *CsLPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CsLPCInterface_RemoteEntitiesScenarios_Call { +func (_c *CsLPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CsLPCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *CsLPCInterface) RemoveUseCase() { + _m.Called() } // CsLPCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -724,20 +686,21 @@ func (_c *CsLPCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CsLPCInte return _c } -// SetConsumptionLimit provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) SetConsumptionLimit(limit api0.LoadLimit) error { - ret := _mock.Called(limit) +// SetConsumptionLimit provides a mock function with given fields: limit +func (_m *CsLPCInterface) SetConsumptionLimit(limit api.LoadLimit) error { + ret := _m.Called(limit) if len(ret) == 0 { panic("no return value specified for SetConsumptionLimit") } var r0 error - if returnFunc, ok := ret.Get(0).(func(api0.LoadLimit) error); ok { - r0 = returnFunc(limit) + if rf, ok := ret.Get(0).(func(api.LoadLimit) error); ok { + r0 = rf(limit) } else { r0 = ret.Error(0) } + return r0 } @@ -747,20 +710,14 @@ type CsLPCInterface_SetConsumptionLimit_Call struct { } // SetConsumptionLimit is a helper method to define mock.On call -// - limit api0.LoadLimit +// - limit api.LoadLimit func (_e *CsLPCInterface_Expecter) SetConsumptionLimit(limit interface{}) *CsLPCInterface_SetConsumptionLimit_Call { return &CsLPCInterface_SetConsumptionLimit_Call{Call: _e.mock.On("SetConsumptionLimit", limit)} } -func (_c *CsLPCInterface_SetConsumptionLimit_Call) Run(run func(limit api0.LoadLimit)) *CsLPCInterface_SetConsumptionLimit_Call { +func (_c *CsLPCInterface_SetConsumptionLimit_Call) Run(run func(limit api.LoadLimit)) *CsLPCInterface_SetConsumptionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api0.LoadLimit - if args[0] != nil { - arg0 = args[0].(api0.LoadLimit) - } - run( - arg0, - ) + run(args[0].(api.LoadLimit)) }) return _c } @@ -770,25 +727,26 @@ func (_c *CsLPCInterface_SetConsumptionLimit_Call) Return(resultErr error) *CsLP return _c } -func (_c *CsLPCInterface_SetConsumptionLimit_Call) RunAndReturn(run func(limit api0.LoadLimit) error) *CsLPCInterface_SetConsumptionLimit_Call { +func (_c *CsLPCInterface_SetConsumptionLimit_Call) RunAndReturn(run func(api.LoadLimit) error) *CsLPCInterface_SetConsumptionLimit_Call { _c.Call.Return(run) return _c } -// SetConsumptionNominalMax provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) SetConsumptionNominalMax(value float64) error { - ret := _mock.Called(value) +// SetConsumptionNominalMax provides a mock function with given fields: value +func (_m *CsLPCInterface) SetConsumptionNominalMax(value float64) error { + ret := _m.Called(value) if len(ret) == 0 { panic("no return value specified for SetConsumptionNominalMax") } var r0 error - if returnFunc, ok := ret.Get(0).(func(float64) error); ok { - r0 = returnFunc(value) + if rf, ok := ret.Get(0).(func(float64) error); ok { + r0 = rf(value) } else { r0 = ret.Error(0) } + return r0 } @@ -805,13 +763,7 @@ func (_e *CsLPCInterface_Expecter) SetConsumptionNominalMax(value interface{}) * func (_c *CsLPCInterface_SetConsumptionNominalMax_Call) Run(run func(value float64)) *CsLPCInterface_SetConsumptionNominalMax_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - run( - arg0, - ) + run(args[0].(float64)) }) return _c } @@ -821,25 +773,26 @@ func (_c *CsLPCInterface_SetConsumptionNominalMax_Call) Return(resultErr error) return _c } -func (_c *CsLPCInterface_SetConsumptionNominalMax_Call) RunAndReturn(run func(value float64) error) *CsLPCInterface_SetConsumptionNominalMax_Call { +func (_c *CsLPCInterface_SetConsumptionNominalMax_Call) RunAndReturn(run func(float64) error) *CsLPCInterface_SetConsumptionNominalMax_Call { _c.Call.Return(run) return _c } -// SetFailsafeConsumptionActivePowerLimit provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) SetFailsafeConsumptionActivePowerLimit(value float64, changeable bool) error { - ret := _mock.Called(value, changeable) +// SetFailsafeConsumptionActivePowerLimit provides a mock function with given fields: value, changeable +func (_m *CsLPCInterface) SetFailsafeConsumptionActivePowerLimit(value float64, changeable bool) error { + ret := _m.Called(value, changeable) if len(ret) == 0 { panic("no return value specified for SetFailsafeConsumptionActivePowerLimit") } var r0 error - if returnFunc, ok := ret.Get(0).(func(float64, bool) error); ok { - r0 = returnFunc(value, changeable) + if rf, ok := ret.Get(0).(func(float64, bool) error); ok { + r0 = rf(value, changeable) } else { r0 = ret.Error(0) } + return r0 } @@ -857,18 +810,7 @@ func (_e *CsLPCInterface_Expecter) SetFailsafeConsumptionActivePowerLimit(value func (_c *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call) Run(run func(value float64, changeable bool)) *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 bool - if args[1] != nil { - arg1 = args[1].(bool) - } - run( - arg0, - arg1, - ) + run(args[0].(float64), args[1].(bool)) }) return _c } @@ -878,25 +820,26 @@ func (_c *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call) Return(res return _c } -func (_c *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(value float64, changeable bool) error) *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call { +func (_c *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(float64, bool) error) *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// SetFailsafeDurationMinimum provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) SetFailsafeDurationMinimum(duration time.Duration, changeable bool) error { - ret := _mock.Called(duration, changeable) +// SetFailsafeDurationMinimum provides a mock function with given fields: duration, changeable +func (_m *CsLPCInterface) SetFailsafeDurationMinimum(duration time.Duration, changeable bool) error { + ret := _m.Called(duration, changeable) if len(ret) == 0 { panic("no return value specified for SetFailsafeDurationMinimum") } var r0 error - if returnFunc, ok := ret.Get(0).(func(time.Duration, bool) error); ok { - r0 = returnFunc(duration, changeable) + if rf, ok := ret.Get(0).(func(time.Duration, bool) error); ok { + r0 = rf(duration, changeable) } else { r0 = ret.Error(0) } + return r0 } @@ -914,18 +857,7 @@ func (_e *CsLPCInterface_Expecter) SetFailsafeDurationMinimum(duration interface func (_c *CsLPCInterface_SetFailsafeDurationMinimum_Call) Run(run func(duration time.Duration, changeable bool)) *CsLPCInterface_SetFailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 time.Duration - if args[0] != nil { - arg0 = args[0].(time.Duration) - } - var arg1 bool - if args[1] != nil { - arg1 = args[1].(bool) - } - run( - arg0, - arg1, - ) + run(args[0].(time.Duration), args[1].(bool)) }) return _c } @@ -935,15 +867,14 @@ func (_c *CsLPCInterface_SetFailsafeDurationMinimum_Call) Return(resultErr error return _c } -func (_c *CsLPCInterface_SetFailsafeDurationMinimum_Call) RunAndReturn(run func(duration time.Duration, changeable bool) error) *CsLPCInterface_SetFailsafeDurationMinimum_Call { +func (_c *CsLPCInterface_SetFailsafeDurationMinimum_Call) RunAndReturn(run func(time.Duration, bool) error) *CsLPCInterface_SetFailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } -// StartHeartbeat provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) StartHeartbeat() { - _mock.Called() - return +// StartHeartbeat provides a mock function with no fields +func (_m *CsLPCInterface) StartHeartbeat() { + _m.Called() } // CsLPCInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -973,10 +904,9 @@ func (_c *CsLPCInterface_StartHeartbeat_Call) RunAndReturn(run func()) *CsLPCInt return _c } -// StopHeartbeat provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) StopHeartbeat() { - _mock.Called() - return +// StopHeartbeat provides a mock function with no fields +func (_m *CsLPCInterface) StopHeartbeat() { + _m.Called() } // CsLPCInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -1006,10 +936,9 @@ func (_c *CsLPCInterface_StopHeartbeat_Call) RunAndReturn(run func()) *CsLPCInte return _c } -// UpdateUseCaseAvailability provides a mock function for the type CsLPCInterface -func (_mock *CsLPCInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *CsLPCInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // CsLPCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -1025,13 +954,7 @@ func (_e *CsLPCInterface_Expecter) UpdateUseCaseAvailability(available interface func (_c *CsLPCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CsLPCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -1041,7 +964,21 @@ func (_c *CsLPCInterface_UpdateUseCaseAvailability_Call) Return() *CsLPCInterfac return _c } -func (_c *CsLPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CsLPCInterface_UpdateUseCaseAvailability_Call { +func (_c *CsLPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CsLPCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } + +// NewCsLPCInterface creates a new instance of CsLPCInterface. 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 NewCsLPCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CsLPCInterface { + mock := &CsLPCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/CsLPPInterface.go b/usecases/mocks/CsLPPInterface.go index 1d759382..ebb81b1b 100644 --- a/usecases/mocks/CsLPPInterface.go +++ b/usecases/mocks/CsLPPInterface.go @@ -1,32 +1,19 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "time" + eebus_goapi "github.com/enbility/eebus-go/api" + api "github.com/enbility/eebus-go/usecases/api" - api1 "github.com/enbility/eebus-go/api" - api0 "github.com/enbility/eebus-go/usecases/api" - "github.com/enbility/spine-go/api" - "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" -) -// NewCsLPPInterface creates a new instance of CsLPPInterface. 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 NewCsLPPInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CsLPPInterface { - mock := &CsLPPInterface{} - mock.Mock.Test(t) + model "github.com/enbility/spine-go/model" - t.Cleanup(func() { mock.AssertExpectations(t) }) + spine_goapi "github.com/enbility/spine-go/api" - return mock -} + time "time" +) // CsLPPInterface is an autogenerated mock type for the CsLPPInterface type type CsLPPInterface struct { @@ -41,20 +28,21 @@ func (_m *CsLPPInterface) EXPECT() *CsLPPInterface_Expecter { return &CsLPPInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *CsLPPInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -75,8 +63,8 @@ func (_c *CsLPPInterface_AddFeatures_Call) Run(run func()) *CsLPPInterface_AddFe return _c } -func (_c *CsLPPInterface_AddFeatures_Call) Return(err error) *CsLPPInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *CsLPPInterface_AddFeatures_Call) Return(_a0 error) *CsLPPInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -85,10 +73,9 @@ func (_c *CsLPPInterface_AddFeatures_Call) RunAndReturn(run func() error) *CsLPP return _c } -// AddUseCase provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *CsLPPInterface) AddUseCase() { + _m.Called() } // CsLPPInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -118,10 +105,9 @@ func (_c *CsLPPInterface_AddUseCase_Call) RunAndReturn(run func()) *CsLPPInterfa return _c } -// ApproveOrDenyProductionLimit provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) ApproveOrDenyProductionLimit(msgCounter model.MsgCounterType, approve bool, reason string) { - _mock.Called(msgCounter, approve, reason) - return +// ApproveOrDenyProductionLimit provides a mock function with given fields: msgCounter, approve, reason +func (_m *CsLPPInterface) ApproveOrDenyProductionLimit(msgCounter model.MsgCounterType, approve bool, reason string) { + _m.Called(msgCounter, approve, reason) } // CsLPPInterface_ApproveOrDenyProductionLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApproveOrDenyProductionLimit' @@ -139,23 +125,7 @@ func (_e *CsLPPInterface_Expecter) ApproveOrDenyProductionLimit(msgCounter inter func (_c *CsLPPInterface_ApproveOrDenyProductionLimit_Call) Run(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPPInterface_ApproveOrDenyProductionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 model.MsgCounterType - if args[0] != nil { - arg0 = args[0].(model.MsgCounterType) - } - var arg1 bool - if args[1] != nil { - arg1 = args[1].(bool) - } - var arg2 string - if args[2] != nil { - arg2 = args[2].(string) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(model.MsgCounterType), args[1].(bool), args[2].(string)) }) return _c } @@ -165,27 +135,28 @@ func (_c *CsLPPInterface_ApproveOrDenyProductionLimit_Call) Return() *CsLPPInter return _c } -func (_c *CsLPPInterface_ApproveOrDenyProductionLimit_Call) RunAndReturn(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPPInterface_ApproveOrDenyProductionLimit_Call { +func (_c *CsLPPInterface_ApproveOrDenyProductionLimit_Call) RunAndReturn(run func(model.MsgCounterType, bool, string)) *CsLPPInterface_ApproveOrDenyProductionLimit_Call { _c.Run(run) return _c } -// AvailableScenariosForEntity provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *CsLPPInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -195,37 +166,31 @@ type CsLPPInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CsLPPInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CsLPPInterface_AvailableScenariosForEntity_Call { return &CsLPPInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CsLPPInterface_AvailableScenariosForEntity_Call { +func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CsLPPInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CsLPPInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CsLPPInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CsLPPInterface_AvailableScenariosForEntity_Call { +func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CsLPPInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// FailsafeDurationMinimum provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) FailsafeDurationMinimum() (time.Duration, bool, error) { - ret := _mock.Called() +// FailsafeDurationMinimum provides a mock function with no fields +func (_m *CsLPPInterface) FailsafeDurationMinimum() (time.Duration, bool, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for FailsafeDurationMinimum") @@ -234,24 +199,27 @@ func (_mock *CsLPPInterface) FailsafeDurationMinimum() (time.Duration, bool, err var r0 time.Duration var r1 bool var r2 error - if returnFunc, ok := ret.Get(0).(func() (time.Duration, bool, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (time.Duration, bool, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() time.Duration); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() time.Duration); ok { + r0 = rf() } else { r0 = ret.Get(0).(time.Duration) } - if returnFunc, ok := ret.Get(1).(func() bool); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() bool); ok { + r1 = rf() } else { r1 = ret.Get(1).(bool) } - if returnFunc, ok := ret.Get(2).(func() error); ok { - r2 = returnFunc() + + if rf, ok := ret.Get(2).(func() error); ok { + r2 = rf() } else { r2 = ret.Error(2) } + return r0, r1, r2 } @@ -282,9 +250,9 @@ func (_c *CsLPPInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func() ( return _c } -// FailsafeProductionActivePowerLimit provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) FailsafeProductionActivePowerLimit() (float64, bool, error) { - ret := _mock.Called() +// FailsafeProductionActivePowerLimit provides a mock function with no fields +func (_m *CsLPPInterface) FailsafeProductionActivePowerLimit() (float64, bool, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for FailsafeProductionActivePowerLimit") @@ -293,24 +261,27 @@ func (_mock *CsLPPInterface) FailsafeProductionActivePowerLimit() (float64, bool var r0 float64 var r1 bool var r2 error - if returnFunc, ok := ret.Get(0).(func() (float64, bool, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (float64, bool, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() float64); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() float64); ok { + r0 = rf() } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func() bool); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() bool); ok { + r1 = rf() } else { r1 = ret.Get(1).(bool) } - if returnFunc, ok := ret.Get(2).(func() error); ok { - r2 = returnFunc() + + if rf, ok := ret.Get(2).(func() error); ok { + r2 = rf() } else { r2 = ret.Error(2) } + return r0, r1, r2 } @@ -341,20 +312,21 @@ func (_c *CsLPPInterface_FailsafeProductionActivePowerLimit_Call) RunAndReturn(r return _c } -// IsCompatibleEntityType provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *CsLPPInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -364,48 +336,43 @@ type CsLPPInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *CsLPPInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CsLPPInterface_IsCompatibleEntityType_Call { return &CsLPPInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CsLPPInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CsLPPInterface_IsCompatibleEntityType_Call { +func (_c *CsLPPInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CsLPPInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *CsLPPInterface_IsCompatibleEntityType_Call) Return(b bool) *CsLPPInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *CsLPPInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CsLPPInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *CsLPPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CsLPPInterface_IsCompatibleEntityType_Call { +func (_c *CsLPPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CsLPPInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsHeartbeatWithinDuration provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) IsHeartbeatWithinDuration() bool { - ret := _mock.Called() +// IsHeartbeatWithinDuration provides a mock function with no fields +func (_m *CsLPPInterface) IsHeartbeatWithinDuration() bool { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for IsHeartbeatWithinDuration") } var r0 bool - if returnFunc, ok := ret.Get(0).(func() bool); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -426,8 +393,8 @@ func (_c *CsLPPInterface_IsHeartbeatWithinDuration_Call) Run(run func()) *CsLPPI return _c } -func (_c *CsLPPInterface_IsHeartbeatWithinDuration_Call) Return(b bool) *CsLPPInterface_IsHeartbeatWithinDuration_Call { - _c.Call.Return(b) +func (_c *CsLPPInterface_IsHeartbeatWithinDuration_Call) Return(_a0 bool) *CsLPPInterface_IsHeartbeatWithinDuration_Call { + _c.Call.Return(_a0) return _c } @@ -436,20 +403,21 @@ func (_c *CsLPPInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func() return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *CsLPPInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -459,56 +427,46 @@ type CsLPPInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *CsLPPInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { return &CsLPPInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// PendingProductionLimits provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) PendingProductionLimits() map[model.MsgCounterType]api0.LoadLimit { - ret := _mock.Called() +// PendingProductionLimits provides a mock function with no fields +func (_m *CsLPPInterface) PendingProductionLimits() map[model.MsgCounterType]api.LoadLimit { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for PendingProductionLimits") } - var r0 map[model.MsgCounterType]api0.LoadLimit - if returnFunc, ok := ret.Get(0).(func() map[model.MsgCounterType]api0.LoadLimit); ok { - r0 = returnFunc() + var r0 map[model.MsgCounterType]api.LoadLimit + if rf, ok := ret.Get(0).(func() map[model.MsgCounterType]api.LoadLimit); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[model.MsgCounterType]api0.LoadLimit) + r0 = ret.Get(0).(map[model.MsgCounterType]api.LoadLimit) } } + return r0 } @@ -529,39 +487,41 @@ func (_c *CsLPPInterface_PendingProductionLimits_Call) Run(run func()) *CsLPPInt return _c } -func (_c *CsLPPInterface_PendingProductionLimits_Call) Return(msgCounterTypeToLoadLimit map[model.MsgCounterType]api0.LoadLimit) *CsLPPInterface_PendingProductionLimits_Call { - _c.Call.Return(msgCounterTypeToLoadLimit) +func (_c *CsLPPInterface_PendingProductionLimits_Call) Return(_a0 map[model.MsgCounterType]api.LoadLimit) *CsLPPInterface_PendingProductionLimits_Call { + _c.Call.Return(_a0) return _c } -func (_c *CsLPPInterface_PendingProductionLimits_Call) RunAndReturn(run func() map[model.MsgCounterType]api0.LoadLimit) *CsLPPInterface_PendingProductionLimits_Call { +func (_c *CsLPPInterface_PendingProductionLimits_Call) RunAndReturn(run func() map[model.MsgCounterType]api.LoadLimit) *CsLPPInterface_PendingProductionLimits_Call { _c.Call.Return(run) return _c } -// ProductionLimit provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) ProductionLimit() (api0.LoadLimit, error) { - ret := _mock.Called() +// ProductionLimit provides a mock function with no fields +func (_m *CsLPPInterface) ProductionLimit() (api.LoadLimit, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for ProductionLimit") } - var r0 api0.LoadLimit + var r0 api.LoadLimit var r1 error - if returnFunc, ok := ret.Get(0).(func() (api0.LoadLimit, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (api.LoadLimit, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() api0.LoadLimit); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() api.LoadLimit); ok { + r0 = rf() } else { - r0 = ret.Get(0).(api0.LoadLimit) + r0 = ret.Get(0).(api.LoadLimit) } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -582,19 +542,19 @@ func (_c *CsLPPInterface_ProductionLimit_Call) Run(run func()) *CsLPPInterface_P return _c } -func (_c *CsLPPInterface_ProductionLimit_Call) Return(loadLimit api0.LoadLimit, err error) *CsLPPInterface_ProductionLimit_Call { - _c.Call.Return(loadLimit, err) +func (_c *CsLPPInterface_ProductionLimit_Call) Return(_a0 api.LoadLimit, _a1 error) *CsLPPInterface_ProductionLimit_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *CsLPPInterface_ProductionLimit_Call) RunAndReturn(run func() (api0.LoadLimit, error)) *CsLPPInterface_ProductionLimit_Call { +func (_c *CsLPPInterface_ProductionLimit_Call) RunAndReturn(run func() (api.LoadLimit, error)) *CsLPPInterface_ProductionLimit_Call { _c.Call.Return(run) return _c } -// ProductionNominalMax provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) ProductionNominalMax() (float64, error) { - ret := _mock.Called() +// ProductionNominalMax provides a mock function with no fields +func (_m *CsLPPInterface) ProductionNominalMax() (float64, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for ProductionNominalMax") @@ -602,19 +562,21 @@ func (_mock *CsLPPInterface) ProductionNominalMax() (float64, error) { var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (float64, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() float64); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() float64); ok { + r0 = rf() } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -635,8 +597,8 @@ func (_c *CsLPPInterface_ProductionNominalMax_Call) Run(run func()) *CsLPPInterf return _c } -func (_c *CsLPPInterface_ProductionNominalMax_Call) Return(f float64, err error) *CsLPPInterface_ProductionNominalMax_Call { - _c.Call.Return(f, err) +func (_c *CsLPPInterface_ProductionNominalMax_Call) Return(_a0 float64, _a1 error) *CsLPPInterface_ProductionNominalMax_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -645,22 +607,23 @@ func (_c *CsLPPInterface_ProductionNominalMax_Call) RunAndReturn(run func() (flo return _c } -// RemoteEntitiesScenarios provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *CsLPPInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api1.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api1.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -681,20 +644,19 @@ func (_c *CsLPPInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CsLPPInt return _c } -func (_c *CsLPPInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CsLPPInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *CsLPPInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CsLPPInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *CsLPPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CsLPPInterface_RemoteEntitiesScenarios_Call { +func (_c *CsLPPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CsLPPInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *CsLPPInterface) RemoveUseCase() { + _m.Called() } // CsLPPInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -724,20 +686,21 @@ func (_c *CsLPPInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CsLPPInte return _c } -// SetFailsafeDurationMinimum provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) SetFailsafeDurationMinimum(duration time.Duration, changeable bool) error { - ret := _mock.Called(duration, changeable) +// SetFailsafeDurationMinimum provides a mock function with given fields: duration, changeable +func (_m *CsLPPInterface) SetFailsafeDurationMinimum(duration time.Duration, changeable bool) error { + ret := _m.Called(duration, changeable) if len(ret) == 0 { panic("no return value specified for SetFailsafeDurationMinimum") } var r0 error - if returnFunc, ok := ret.Get(0).(func(time.Duration, bool) error); ok { - r0 = returnFunc(duration, changeable) + if rf, ok := ret.Get(0).(func(time.Duration, bool) error); ok { + r0 = rf(duration, changeable) } else { r0 = ret.Error(0) } + return r0 } @@ -755,18 +718,7 @@ func (_e *CsLPPInterface_Expecter) SetFailsafeDurationMinimum(duration interface func (_c *CsLPPInterface_SetFailsafeDurationMinimum_Call) Run(run func(duration time.Duration, changeable bool)) *CsLPPInterface_SetFailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 time.Duration - if args[0] != nil { - arg0 = args[0].(time.Duration) - } - var arg1 bool - if args[1] != nil { - arg1 = args[1].(bool) - } - run( - arg0, - arg1, - ) + run(args[0].(time.Duration), args[1].(bool)) }) return _c } @@ -776,25 +728,26 @@ func (_c *CsLPPInterface_SetFailsafeDurationMinimum_Call) Return(resultErr error return _c } -func (_c *CsLPPInterface_SetFailsafeDurationMinimum_Call) RunAndReturn(run func(duration time.Duration, changeable bool) error) *CsLPPInterface_SetFailsafeDurationMinimum_Call { +func (_c *CsLPPInterface_SetFailsafeDurationMinimum_Call) RunAndReturn(run func(time.Duration, bool) error) *CsLPPInterface_SetFailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } -// SetFailsafeProductionActivePowerLimit provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) SetFailsafeProductionActivePowerLimit(value float64, changeable bool) error { - ret := _mock.Called(value, changeable) +// SetFailsafeProductionActivePowerLimit provides a mock function with given fields: value, changeable +func (_m *CsLPPInterface) SetFailsafeProductionActivePowerLimit(value float64, changeable bool) error { + ret := _m.Called(value, changeable) if len(ret) == 0 { panic("no return value specified for SetFailsafeProductionActivePowerLimit") } var r0 error - if returnFunc, ok := ret.Get(0).(func(float64, bool) error); ok { - r0 = returnFunc(value, changeable) + if rf, ok := ret.Get(0).(func(float64, bool) error); ok { + r0 = rf(value, changeable) } else { r0 = ret.Error(0) } + return r0 } @@ -812,18 +765,7 @@ func (_e *CsLPPInterface_Expecter) SetFailsafeProductionActivePowerLimit(value i func (_c *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call) Run(run func(value float64, changeable bool)) *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 bool - if args[1] != nil { - arg1 = args[1].(bool) - } - run( - arg0, - arg1, - ) + run(args[0].(float64), args[1].(bool)) }) return _c } @@ -833,25 +775,26 @@ func (_c *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call) Return(resu return _c } -func (_c *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(value float64, changeable bool) error) *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call { +func (_c *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(float64, bool) error) *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// SetProductionLimit provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) SetProductionLimit(limit api0.LoadLimit) error { - ret := _mock.Called(limit) +// SetProductionLimit provides a mock function with given fields: limit +func (_m *CsLPPInterface) SetProductionLimit(limit api.LoadLimit) error { + ret := _m.Called(limit) if len(ret) == 0 { panic("no return value specified for SetProductionLimit") } var r0 error - if returnFunc, ok := ret.Get(0).(func(api0.LoadLimit) error); ok { - r0 = returnFunc(limit) + if rf, ok := ret.Get(0).(func(api.LoadLimit) error); ok { + r0 = rf(limit) } else { r0 = ret.Error(0) } + return r0 } @@ -861,20 +804,14 @@ type CsLPPInterface_SetProductionLimit_Call struct { } // SetProductionLimit is a helper method to define mock.On call -// - limit api0.LoadLimit +// - limit api.LoadLimit func (_e *CsLPPInterface_Expecter) SetProductionLimit(limit interface{}) *CsLPPInterface_SetProductionLimit_Call { return &CsLPPInterface_SetProductionLimit_Call{Call: _e.mock.On("SetProductionLimit", limit)} } -func (_c *CsLPPInterface_SetProductionLimit_Call) Run(run func(limit api0.LoadLimit)) *CsLPPInterface_SetProductionLimit_Call { +func (_c *CsLPPInterface_SetProductionLimit_Call) Run(run func(limit api.LoadLimit)) *CsLPPInterface_SetProductionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api0.LoadLimit - if args[0] != nil { - arg0 = args[0].(api0.LoadLimit) - } - run( - arg0, - ) + run(args[0].(api.LoadLimit)) }) return _c } @@ -884,25 +821,26 @@ func (_c *CsLPPInterface_SetProductionLimit_Call) Return(resultErr error) *CsLPP return _c } -func (_c *CsLPPInterface_SetProductionLimit_Call) RunAndReturn(run func(limit api0.LoadLimit) error) *CsLPPInterface_SetProductionLimit_Call { +func (_c *CsLPPInterface_SetProductionLimit_Call) RunAndReturn(run func(api.LoadLimit) error) *CsLPPInterface_SetProductionLimit_Call { _c.Call.Return(run) return _c } -// SetProductionNominalMax provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) SetProductionNominalMax(value float64) error { - ret := _mock.Called(value) +// SetProductionNominalMax provides a mock function with given fields: value +func (_m *CsLPPInterface) SetProductionNominalMax(value float64) error { + ret := _m.Called(value) if len(ret) == 0 { panic("no return value specified for SetProductionNominalMax") } var r0 error - if returnFunc, ok := ret.Get(0).(func(float64) error); ok { - r0 = returnFunc(value) + if rf, ok := ret.Get(0).(func(float64) error); ok { + r0 = rf(value) } else { r0 = ret.Error(0) } + return r0 } @@ -919,13 +857,7 @@ func (_e *CsLPPInterface_Expecter) SetProductionNominalMax(value interface{}) *C func (_c *CsLPPInterface_SetProductionNominalMax_Call) Run(run func(value float64)) *CsLPPInterface_SetProductionNominalMax_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - run( - arg0, - ) + run(args[0].(float64)) }) return _c } @@ -935,15 +867,14 @@ func (_c *CsLPPInterface_SetProductionNominalMax_Call) Return(resultErr error) * return _c } -func (_c *CsLPPInterface_SetProductionNominalMax_Call) RunAndReturn(run func(value float64) error) *CsLPPInterface_SetProductionNominalMax_Call { +func (_c *CsLPPInterface_SetProductionNominalMax_Call) RunAndReturn(run func(float64) error) *CsLPPInterface_SetProductionNominalMax_Call { _c.Call.Return(run) return _c } -// StartHeartbeat provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) StartHeartbeat() { - _mock.Called() - return +// StartHeartbeat provides a mock function with no fields +func (_m *CsLPPInterface) StartHeartbeat() { + _m.Called() } // CsLPPInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -973,10 +904,9 @@ func (_c *CsLPPInterface_StartHeartbeat_Call) RunAndReturn(run func()) *CsLPPInt return _c } -// StopHeartbeat provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) StopHeartbeat() { - _mock.Called() - return +// StopHeartbeat provides a mock function with no fields +func (_m *CsLPPInterface) StopHeartbeat() { + _m.Called() } // CsLPPInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -1006,10 +936,9 @@ func (_c *CsLPPInterface_StopHeartbeat_Call) RunAndReturn(run func()) *CsLPPInte return _c } -// UpdateUseCaseAvailability provides a mock function for the type CsLPPInterface -func (_mock *CsLPPInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *CsLPPInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // CsLPPInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -1025,13 +954,7 @@ func (_e *CsLPPInterface_Expecter) UpdateUseCaseAvailability(available interface func (_c *CsLPPInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CsLPPInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -1041,7 +964,21 @@ func (_c *CsLPPInterface_UpdateUseCaseAvailability_Call) Return() *CsLPPInterfac return _c } -func (_c *CsLPPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CsLPPInterface_UpdateUseCaseAvailability_Call { +func (_c *CsLPPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CsLPPInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } + +// NewCsLPPInterface creates a new instance of CsLPPInterface. 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 NewCsLPPInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CsLPPInterface { + mock := &CsLPPInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/EgLPCInterface.go b/usecases/mocks/EgLPCInterface.go index f88e5516..3633f240 100644 --- a/usecases/mocks/EgLPCInterface.go +++ b/usecases/mocks/EgLPCInterface.go @@ -1,32 +1,19 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "time" + eebus_goapi "github.com/enbility/eebus-go/api" + api "github.com/enbility/eebus-go/usecases/api" - api1 "github.com/enbility/eebus-go/api" - api0 "github.com/enbility/eebus-go/usecases/api" - "github.com/enbility/spine-go/api" - "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" -) -// NewEgLPCInterface creates a new instance of EgLPCInterface. 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 NewEgLPCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *EgLPCInterface { - mock := &EgLPCInterface{} - mock.Mock.Test(t) + model "github.com/enbility/spine-go/model" - t.Cleanup(func() { mock.AssertExpectations(t) }) + spine_goapi "github.com/enbility/spine-go/api" - return mock -} + time "time" +) // EgLPCInterface is an autogenerated mock type for the EgLPCInterface type type EgLPCInterface struct { @@ -41,20 +28,21 @@ func (_m *EgLPCInterface) EXPECT() *EgLPCInterface_Expecter { return &EgLPCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *EgLPCInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -75,8 +63,8 @@ func (_c *EgLPCInterface_AddFeatures_Call) Run(run func()) *EgLPCInterface_AddFe return _c } -func (_c *EgLPCInterface_AddFeatures_Call) Return(err error) *EgLPCInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *EgLPCInterface_AddFeatures_Call) Return(_a0 error) *EgLPCInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -85,10 +73,9 @@ func (_c *EgLPCInterface_AddFeatures_Call) RunAndReturn(run func() error) *EgLPC return _c } -// AddUseCase provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *EgLPCInterface) AddUseCase() { + _m.Called() } // EgLPCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -118,22 +105,23 @@ func (_c *EgLPCInterface_AddUseCase_Call) RunAndReturn(run func()) *EgLPCInterfa return _c } -// AvailableScenariosForEntity provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *EgLPCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -143,57 +131,53 @@ type EgLPCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *EgLPCInterface_AvailableScenariosForEntity_Call { return &EgLPCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_AvailableScenariosForEntity_Call { +func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *EgLPCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *EgLPCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *EgLPCInterface_AvailableScenariosForEntity_Call { +func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *EgLPCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// ConsumptionLimit provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) ConsumptionLimit(entity api.EntityRemoteInterface) (api0.LoadLimit, error) { - ret := _mock.Called(entity) +// ConsumptionLimit provides a mock function with given fields: entity +func (_m *EgLPCInterface) ConsumptionLimit(entity spine_goapi.EntityRemoteInterface) (api.LoadLimit, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for ConsumptionLimit") } - var r0 api0.LoadLimit + var r0 api.LoadLimit var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.LoadLimit, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.LoadLimit, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.LoadLimit); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.LoadLimit); ok { + r0 = rf(entity) } else { - r0 = ret.Get(0).(api0.LoadLimit) + r0 = ret.Get(0).(api.LoadLimit) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -203,37 +187,31 @@ type EgLPCInterface_ConsumptionLimit_Call struct { } // ConsumptionLimit is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) ConsumptionLimit(entity interface{}) *EgLPCInterface_ConsumptionLimit_Call { return &EgLPCInterface_ConsumptionLimit_Call{Call: _e.mock.On("ConsumptionLimit", entity)} } -func (_c *EgLPCInterface_ConsumptionLimit_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_ConsumptionLimit_Call { +func (_c *EgLPCInterface_ConsumptionLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_ConsumptionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPCInterface_ConsumptionLimit_Call) Return(limit api0.LoadLimit, resultErr error) *EgLPCInterface_ConsumptionLimit_Call { +func (_c *EgLPCInterface_ConsumptionLimit_Call) Return(limit api.LoadLimit, resultErr error) *EgLPCInterface_ConsumptionLimit_Call { _c.Call.Return(limit, resultErr) return _c } -func (_c *EgLPCInterface_ConsumptionLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.LoadLimit, error)) *EgLPCInterface_ConsumptionLimit_Call { +func (_c *EgLPCInterface_ConsumptionLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.LoadLimit, error)) *EgLPCInterface_ConsumptionLimit_Call { _c.Call.Return(run) return _c } -// ConsumptionNominalMax provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) ConsumptionNominalMax(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// ConsumptionNominalMax provides a mock function with given fields: entity +func (_m *EgLPCInterface) ConsumptionNominalMax(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for ConsumptionNominalMax") @@ -241,19 +219,21 @@ func (_mock *EgLPCInterface) ConsumptionNominalMax(entity api.EntityRemoteInterf var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -263,37 +243,31 @@ type EgLPCInterface_ConsumptionNominalMax_Call struct { } // ConsumptionNominalMax is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) ConsumptionNominalMax(entity interface{}) *EgLPCInterface_ConsumptionNominalMax_Call { return &EgLPCInterface_ConsumptionNominalMax_Call{Call: _e.mock.On("ConsumptionNominalMax", entity)} } -func (_c *EgLPCInterface_ConsumptionNominalMax_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_ConsumptionNominalMax_Call { +func (_c *EgLPCInterface_ConsumptionNominalMax_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_ConsumptionNominalMax_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPCInterface_ConsumptionNominalMax_Call) Return(f float64, err error) *EgLPCInterface_ConsumptionNominalMax_Call { - _c.Call.Return(f, err) +func (_c *EgLPCInterface_ConsumptionNominalMax_Call) Return(_a0 float64, _a1 error) *EgLPCInterface_ConsumptionNominalMax_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPCInterface_ConsumptionNominalMax_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *EgLPCInterface_ConsumptionNominalMax_Call { +func (_c *EgLPCInterface_ConsumptionNominalMax_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *EgLPCInterface_ConsumptionNominalMax_Call { _c.Call.Return(run) return _c } -// FailsafeConsumptionActivePowerLimit provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) FailsafeConsumptionActivePowerLimit(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// FailsafeConsumptionActivePowerLimit provides a mock function with given fields: entity +func (_m *EgLPCInterface) FailsafeConsumptionActivePowerLimit(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for FailsafeConsumptionActivePowerLimit") @@ -301,19 +275,21 @@ func (_mock *EgLPCInterface) FailsafeConsumptionActivePowerLimit(entity api.Enti var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -323,37 +299,31 @@ type EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call struct { } // FailsafeConsumptionActivePowerLimit is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) FailsafeConsumptionActivePowerLimit(entity interface{}) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { return &EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call{Call: _e.mock.On("FailsafeConsumptionActivePowerLimit", entity)} } -func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { +func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) Return(f float64, err error) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { - _c.Call.Return(f, err) +func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) Return(_a0 float64, _a1 error) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { +func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// FailsafeDurationMinimum provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) FailsafeDurationMinimum(entity api.EntityRemoteInterface) (time.Duration, error) { - ret := _mock.Called(entity) +// FailsafeDurationMinimum provides a mock function with given fields: entity +func (_m *EgLPCInterface) FailsafeDurationMinimum(entity spine_goapi.EntityRemoteInterface) (time.Duration, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for FailsafeDurationMinimum") @@ -361,19 +331,21 @@ func (_mock *EgLPCInterface) FailsafeDurationMinimum(entity api.EntityRemoteInte var r0 time.Duration var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (time.Duration, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (time.Duration, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) time.Duration); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) time.Duration); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(time.Duration) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -383,48 +355,43 @@ type EgLPCInterface_FailsafeDurationMinimum_Call struct { } // FailsafeDurationMinimum is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) FailsafeDurationMinimum(entity interface{}) *EgLPCInterface_FailsafeDurationMinimum_Call { return &EgLPCInterface_FailsafeDurationMinimum_Call{Call: _e.mock.On("FailsafeDurationMinimum", entity)} } -func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_FailsafeDurationMinimum_Call { +func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_FailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) Return(duration time.Duration, err error) *EgLPCInterface_FailsafeDurationMinimum_Call { - _c.Call.Return(duration, err) +func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) Return(_a0 time.Duration, _a1 error) *EgLPCInterface_FailsafeDurationMinimum_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (time.Duration, error)) *EgLPCInterface_FailsafeDurationMinimum_Call { +func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (time.Duration, error)) *EgLPCInterface_FailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *EgLPCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -434,48 +401,43 @@ type EgLPCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *EgLPCInterface_IsCompatibleEntityType_Call { return &EgLPCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *EgLPCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_IsCompatibleEntityType_Call { +func (_c *EgLPCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPCInterface_IsCompatibleEntityType_Call) Return(b bool) *EgLPCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *EgLPCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *EgLPCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *EgLPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *EgLPCInterface_IsCompatibleEntityType_Call { +func (_c *EgLPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *EgLPCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsHeartbeatWithinDuration provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) IsHeartbeatWithinDuration(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsHeartbeatWithinDuration provides a mock function with given fields: entity +func (_m *EgLPCInterface) IsHeartbeatWithinDuration(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsHeartbeatWithinDuration") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -485,48 +447,43 @@ type EgLPCInterface_IsHeartbeatWithinDuration_Call struct { } // IsHeartbeatWithinDuration is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) IsHeartbeatWithinDuration(entity interface{}) *EgLPCInterface_IsHeartbeatWithinDuration_Call { return &EgLPCInterface_IsHeartbeatWithinDuration_Call{Call: _e.mock.On("IsHeartbeatWithinDuration", entity)} } -func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_IsHeartbeatWithinDuration_Call { +func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_IsHeartbeatWithinDuration_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) Return(b bool) *EgLPCInterface_IsHeartbeatWithinDuration_Call { - _c.Call.Return(b) +func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) Return(_a0 bool) *EgLPCInterface_IsHeartbeatWithinDuration_Call { + _c.Call.Return(_a0) return _c } -func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *EgLPCInterface_IsHeartbeatWithinDuration_Call { +func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *EgLPCInterface_IsHeartbeatWithinDuration_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *EgLPCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -536,56 +493,46 @@ type EgLPCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *EgLPCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { return &EgLPCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *EgLPCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api1.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api1.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -606,20 +553,19 @@ func (_c *EgLPCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *EgLPCInt return _c } -func (_c *EgLPCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *EgLPCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *EgLPCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *EgLPCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *EgLPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *EgLPCInterface_RemoteEntitiesScenarios_Call { +func (_c *EgLPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *EgLPCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *EgLPCInterface) RemoveUseCase() { + _m.Called() } // EgLPCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -649,10 +595,9 @@ func (_c *EgLPCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *EgLPCInte return _c } -// StartHeartbeat provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) StartHeartbeat() { - _mock.Called() - return +// StartHeartbeat provides a mock function with no fields +func (_m *EgLPCInterface) StartHeartbeat() { + _m.Called() } // EgLPCInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -682,10 +627,9 @@ func (_c *EgLPCInterface_StartHeartbeat_Call) RunAndReturn(run func()) *EgLPCInt return _c } -// StopHeartbeat provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) StopHeartbeat() { - _mock.Called() - return +// StopHeartbeat provides a mock function with no fields +func (_m *EgLPCInterface) StopHeartbeat() { + _m.Called() } // EgLPCInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -715,10 +659,9 @@ func (_c *EgLPCInterface_StopHeartbeat_Call) RunAndReturn(run func()) *EgLPCInte return _c } -// UpdateUseCaseAvailability provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *EgLPCInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // EgLPCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -734,13 +677,7 @@ func (_e *EgLPCInterface_Expecter) UpdateUseCaseAvailability(available interface func (_c *EgLPCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *EgLPCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -750,14 +687,14 @@ func (_c *EgLPCInterface_UpdateUseCaseAvailability_Call) Return() *EgLPCInterfac return _c } -func (_c *EgLPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *EgLPCInterface_UpdateUseCaseAvailability_Call { +func (_c *EgLPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *EgLPCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// WriteConsumptionLimit provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) WriteConsumptionLimit(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error) { - ret := _mock.Called(entity, limit, resultCB) +// WriteConsumptionLimit provides a mock function with given fields: entity, limit, resultCB +func (_m *EgLPCInterface) WriteConsumptionLimit(entity spine_goapi.EntityRemoteInterface, limit api.LoadLimit, resultCB func(model.ResultDataType)) (*model.MsgCounterType, error) { + ret := _m.Called(entity, limit, resultCB) if len(ret) == 0 { panic("no return value specified for WriteConsumptionLimit") @@ -765,21 +702,23 @@ func (_mock *EgLPCInterface) WriteConsumptionLimit(entity api.EntityRemoteInterf var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) (*model.MsgCounterType, error)); ok { - return returnFunc(entity, limit, resultCB) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) (*model.MsgCounterType, error)); ok { + return rf(entity, limit, resultCB) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) *model.MsgCounterType); ok { - r0 = returnFunc(entity, limit, resultCB) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) *model.MsgCounterType); ok { + r0 = rf(entity, limit, resultCB) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) error); ok { - r1 = returnFunc(entity, limit, resultCB) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) error); ok { + r1 = rf(entity, limit, resultCB) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -789,49 +728,33 @@ type EgLPCInterface_WriteConsumptionLimit_Call struct { } // WriteConsumptionLimit is a helper method to define mock.On call -// - entity api.EntityRemoteInterface -// - limit api0.LoadLimit -// - resultCB func(result model.ResultDataType) +// - entity spine_goapi.EntityRemoteInterface +// - limit api.LoadLimit +// - resultCB func(model.ResultDataType) func (_e *EgLPCInterface_Expecter) WriteConsumptionLimit(entity interface{}, limit interface{}, resultCB interface{}) *EgLPCInterface_WriteConsumptionLimit_Call { return &EgLPCInterface_WriteConsumptionLimit_Call{Call: _e.mock.On("WriteConsumptionLimit", entity, limit, resultCB)} } -func (_c *EgLPCInterface_WriteConsumptionLimit_Call) Run(run func(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType))) *EgLPCInterface_WriteConsumptionLimit_Call { +func (_c *EgLPCInterface_WriteConsumptionLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, limit api.LoadLimit, resultCB func(model.ResultDataType))) *EgLPCInterface_WriteConsumptionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 api0.LoadLimit - if args[1] != nil { - arg1 = args[1].(api0.LoadLimit) - } - var arg2 func(result model.ResultDataType) - if args[2] != nil { - arg2 = args[2].(func(result model.ResultDataType)) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(api.LoadLimit), args[2].(func(model.ResultDataType))) }) return _c } -func (_c *EgLPCInterface_WriteConsumptionLimit_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPCInterface_WriteConsumptionLimit_Call { - _c.Call.Return(msgCounterType, err) +func (_c *EgLPCInterface_WriteConsumptionLimit_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPCInterface_WriteConsumptionLimit_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPCInterface_WriteConsumptionLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error)) *EgLPCInterface_WriteConsumptionLimit_Call { +func (_c *EgLPCInterface_WriteConsumptionLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) (*model.MsgCounterType, error)) *EgLPCInterface_WriteConsumptionLimit_Call { _c.Call.Return(run) return _c } -// WriteFailsafeConsumptionActivePowerLimit provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) WriteFailsafeConsumptionActivePowerLimit(entity api.EntityRemoteInterface, value float64) (*model.MsgCounterType, error) { - ret := _mock.Called(entity, value) +// WriteFailsafeConsumptionActivePowerLimit provides a mock function with given fields: entity, value +func (_m *EgLPCInterface) WriteFailsafeConsumptionActivePowerLimit(entity spine_goapi.EntityRemoteInterface, value float64) (*model.MsgCounterType, error) { + ret := _m.Called(entity, value) if len(ret) == 0 { panic("no return value specified for WriteFailsafeConsumptionActivePowerLimit") @@ -839,21 +762,23 @@ func (_mock *EgLPCInterface) WriteFailsafeConsumptionActivePowerLimit(entity api var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, float64) (*model.MsgCounterType, error)); ok { - return returnFunc(entity, value) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, float64) (*model.MsgCounterType, error)); ok { + return rf(entity, value) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, float64) *model.MsgCounterType); ok { - r0 = returnFunc(entity, value) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, float64) *model.MsgCounterType); ok { + r0 = rf(entity, value) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, float64) error); ok { - r1 = returnFunc(entity, value) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, float64) error); ok { + r1 = rf(entity, value) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -863,43 +788,32 @@ type EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call struct { } // WriteFailsafeConsumptionActivePowerLimit is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - value float64 func (_e *EgLPCInterface_Expecter) WriteFailsafeConsumptionActivePowerLimit(entity interface{}, value interface{}) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { return &EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call{Call: _e.mock.On("WriteFailsafeConsumptionActivePowerLimit", entity, value)} } -func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) Run(run func(entity api.EntityRemoteInterface, value float64)) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { +func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, value float64)) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 float64 - if args[1] != nil { - arg1 = args[1].(float64) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(float64)) }) return _c } -func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { - _c.Call.Return(msgCounterType, err) +func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, value float64) (*model.MsgCounterType, error)) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { +func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, float64) (*model.MsgCounterType, error)) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// WriteFailsafeDurationMinimum provides a mock function for the type EgLPCInterface -func (_mock *EgLPCInterface) WriteFailsafeDurationMinimum(entity api.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error) { - ret := _mock.Called(entity, duration) +// WriteFailsafeDurationMinimum provides a mock function with given fields: entity, duration +func (_m *EgLPCInterface) WriteFailsafeDurationMinimum(entity spine_goapi.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error) { + ret := _m.Called(entity, duration) if len(ret) == 0 { panic("no return value specified for WriteFailsafeDurationMinimum") @@ -907,21 +821,23 @@ func (_mock *EgLPCInterface) WriteFailsafeDurationMinimum(entity api.EntityRemot var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)); ok { - return returnFunc(entity, duration) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)); ok { + return rf(entity, duration) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, time.Duration) *model.MsgCounterType); ok { - r0 = returnFunc(entity, duration) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, time.Duration) *model.MsgCounterType); ok { + r0 = rf(entity, duration) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, time.Duration) error); ok { - r1 = returnFunc(entity, duration) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, time.Duration) error); ok { + r1 = rf(entity, duration) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -931,36 +847,39 @@ type EgLPCInterface_WriteFailsafeDurationMinimum_Call struct { } // WriteFailsafeDurationMinimum is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - duration time.Duration func (_e *EgLPCInterface_Expecter) WriteFailsafeDurationMinimum(entity interface{}, duration interface{}) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { return &EgLPCInterface_WriteFailsafeDurationMinimum_Call{Call: _e.mock.On("WriteFailsafeDurationMinimum", entity, duration)} } -func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) Run(run func(entity api.EntityRemoteInterface, duration time.Duration)) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { +func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, duration time.Duration)) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 time.Duration - if args[1] != nil { - arg1 = args[1].(time.Duration) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(time.Duration)) }) return _c } -func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { - _c.Call.Return(msgCounterType, err) +func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error)) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { +func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } + +// NewEgLPCInterface creates a new instance of EgLPCInterface. 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 NewEgLPCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *EgLPCInterface { + mock := &EgLPCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/EgLPPInterface.go b/usecases/mocks/EgLPPInterface.go index d6fdc86a..66b8dccb 100644 --- a/usecases/mocks/EgLPPInterface.go +++ b/usecases/mocks/EgLPPInterface.go @@ -1,32 +1,19 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "time" + eebus_goapi "github.com/enbility/eebus-go/api" + api "github.com/enbility/eebus-go/usecases/api" - api1 "github.com/enbility/eebus-go/api" - api0 "github.com/enbility/eebus-go/usecases/api" - "github.com/enbility/spine-go/api" - "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" -) -// NewEgLPPInterface creates a new instance of EgLPPInterface. 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 NewEgLPPInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *EgLPPInterface { - mock := &EgLPPInterface{} - mock.Mock.Test(t) + model "github.com/enbility/spine-go/model" - t.Cleanup(func() { mock.AssertExpectations(t) }) + spine_goapi "github.com/enbility/spine-go/api" - return mock -} + time "time" +) // EgLPPInterface is an autogenerated mock type for the EgLPPInterface type type EgLPPInterface struct { @@ -41,20 +28,21 @@ func (_m *EgLPPInterface) EXPECT() *EgLPPInterface_Expecter { return &EgLPPInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *EgLPPInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -75,8 +63,8 @@ func (_c *EgLPPInterface_AddFeatures_Call) Run(run func()) *EgLPPInterface_AddFe return _c } -func (_c *EgLPPInterface_AddFeatures_Call) Return(err error) *EgLPPInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *EgLPPInterface_AddFeatures_Call) Return(_a0 error) *EgLPPInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -85,10 +73,9 @@ func (_c *EgLPPInterface_AddFeatures_Call) RunAndReturn(run func() error) *EgLPP return _c } -// AddUseCase provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *EgLPPInterface) AddUseCase() { + _m.Called() } // EgLPPInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -118,22 +105,23 @@ func (_c *EgLPPInterface_AddUseCase_Call) RunAndReturn(run func()) *EgLPPInterfa return _c } -// AvailableScenariosForEntity provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *EgLPPInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -143,37 +131,31 @@ type EgLPPInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *EgLPPInterface_AvailableScenariosForEntity_Call { return &EgLPPInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_AvailableScenariosForEntity_Call { +func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *EgLPPInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *EgLPPInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *EgLPPInterface_AvailableScenariosForEntity_Call { +func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *EgLPPInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// FailsafeDurationMinimum provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) FailsafeDurationMinimum(entity api.EntityRemoteInterface) (time.Duration, error) { - ret := _mock.Called(entity) +// FailsafeDurationMinimum provides a mock function with given fields: entity +func (_m *EgLPPInterface) FailsafeDurationMinimum(entity spine_goapi.EntityRemoteInterface) (time.Duration, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for FailsafeDurationMinimum") @@ -181,19 +163,21 @@ func (_mock *EgLPPInterface) FailsafeDurationMinimum(entity api.EntityRemoteInte var r0 time.Duration var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (time.Duration, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (time.Duration, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) time.Duration); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) time.Duration); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(time.Duration) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -203,37 +187,31 @@ type EgLPPInterface_FailsafeDurationMinimum_Call struct { } // FailsafeDurationMinimum is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) FailsafeDurationMinimum(entity interface{}) *EgLPPInterface_FailsafeDurationMinimum_Call { return &EgLPPInterface_FailsafeDurationMinimum_Call{Call: _e.mock.On("FailsafeDurationMinimum", entity)} } -func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_FailsafeDurationMinimum_Call { +func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_FailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) Return(duration time.Duration, err error) *EgLPPInterface_FailsafeDurationMinimum_Call { - _c.Call.Return(duration, err) +func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) Return(_a0 time.Duration, _a1 error) *EgLPPInterface_FailsafeDurationMinimum_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (time.Duration, error)) *EgLPPInterface_FailsafeDurationMinimum_Call { +func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (time.Duration, error)) *EgLPPInterface_FailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } -// FailsafeProductionActivePowerLimit provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) FailsafeProductionActivePowerLimit(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// FailsafeProductionActivePowerLimit provides a mock function with given fields: entity +func (_m *EgLPPInterface) FailsafeProductionActivePowerLimit(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for FailsafeProductionActivePowerLimit") @@ -241,19 +219,21 @@ func (_mock *EgLPPInterface) FailsafeProductionActivePowerLimit(entity api.Entit var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -263,48 +243,43 @@ type EgLPPInterface_FailsafeProductionActivePowerLimit_Call struct { } // FailsafeProductionActivePowerLimit is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) FailsafeProductionActivePowerLimit(entity interface{}) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { return &EgLPPInterface_FailsafeProductionActivePowerLimit_Call{Call: _e.mock.On("FailsafeProductionActivePowerLimit", entity)} } -func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { +func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) Return(f float64, err error) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { - _c.Call.Return(f, err) +func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) Return(_a0 float64, _a1 error) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { +func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *EgLPPInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -314,48 +289,43 @@ type EgLPPInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) IsCompatibleEntityType(entity interface{}) *EgLPPInterface_IsCompatibleEntityType_Call { return &EgLPPInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *EgLPPInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_IsCompatibleEntityType_Call { +func (_c *EgLPPInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPPInterface_IsCompatibleEntityType_Call) Return(b bool) *EgLPPInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *EgLPPInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *EgLPPInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *EgLPPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *EgLPPInterface_IsCompatibleEntityType_Call { +func (_c *EgLPPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *EgLPPInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsHeartbeatWithinDuration provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) IsHeartbeatWithinDuration(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsHeartbeatWithinDuration provides a mock function with given fields: entity +func (_m *EgLPPInterface) IsHeartbeatWithinDuration(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsHeartbeatWithinDuration") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -365,48 +335,43 @@ type EgLPPInterface_IsHeartbeatWithinDuration_Call struct { } // IsHeartbeatWithinDuration is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) IsHeartbeatWithinDuration(entity interface{}) *EgLPPInterface_IsHeartbeatWithinDuration_Call { return &EgLPPInterface_IsHeartbeatWithinDuration_Call{Call: _e.mock.On("IsHeartbeatWithinDuration", entity)} } -func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_IsHeartbeatWithinDuration_Call { +func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_IsHeartbeatWithinDuration_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) Return(b bool) *EgLPPInterface_IsHeartbeatWithinDuration_Call { - _c.Call.Return(b) +func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) Return(_a0 bool) *EgLPPInterface_IsHeartbeatWithinDuration_Call { + _c.Call.Return(_a0) return _c } -func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *EgLPPInterface_IsHeartbeatWithinDuration_Call { +func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *EgLPPInterface_IsHeartbeatWithinDuration_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *EgLPPInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -416,63 +381,54 @@ type EgLPPInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *EgLPPInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { return &EgLPPInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// ProductionLimit provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) ProductionLimit(entity api.EntityRemoteInterface) (api0.LoadLimit, error) { - ret := _mock.Called(entity) +// ProductionLimit provides a mock function with given fields: entity +func (_m *EgLPPInterface) ProductionLimit(entity spine_goapi.EntityRemoteInterface) (api.LoadLimit, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for ProductionLimit") } - var r0 api0.LoadLimit + var r0 api.LoadLimit var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.LoadLimit, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.LoadLimit, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.LoadLimit); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.LoadLimit); ok { + r0 = rf(entity) } else { - r0 = ret.Get(0).(api0.LoadLimit) + r0 = ret.Get(0).(api.LoadLimit) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -482,37 +438,31 @@ type EgLPPInterface_ProductionLimit_Call struct { } // ProductionLimit is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) ProductionLimit(entity interface{}) *EgLPPInterface_ProductionLimit_Call { return &EgLPPInterface_ProductionLimit_Call{Call: _e.mock.On("ProductionLimit", entity)} } -func (_c *EgLPPInterface_ProductionLimit_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_ProductionLimit_Call { +func (_c *EgLPPInterface_ProductionLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_ProductionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPPInterface_ProductionLimit_Call) Return(limit api0.LoadLimit, resultErr error) *EgLPPInterface_ProductionLimit_Call { +func (_c *EgLPPInterface_ProductionLimit_Call) Return(limit api.LoadLimit, resultErr error) *EgLPPInterface_ProductionLimit_Call { _c.Call.Return(limit, resultErr) return _c } -func (_c *EgLPPInterface_ProductionLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.LoadLimit, error)) *EgLPPInterface_ProductionLimit_Call { +func (_c *EgLPPInterface_ProductionLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.LoadLimit, error)) *EgLPPInterface_ProductionLimit_Call { _c.Call.Return(run) return _c } -// ProductionNominalMax provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) ProductionNominalMax(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// ProductionNominalMax provides a mock function with given fields: entity +func (_m *EgLPPInterface) ProductionNominalMax(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for ProductionNominalMax") @@ -520,19 +470,21 @@ func (_mock *EgLPPInterface) ProductionNominalMax(entity api.EntityRemoteInterfa var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -542,50 +494,45 @@ type EgLPPInterface_ProductionNominalMax_Call struct { } // ProductionNominalMax is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) ProductionNominalMax(entity interface{}) *EgLPPInterface_ProductionNominalMax_Call { return &EgLPPInterface_ProductionNominalMax_Call{Call: _e.mock.On("ProductionNominalMax", entity)} } -func (_c *EgLPPInterface_ProductionNominalMax_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_ProductionNominalMax_Call { +func (_c *EgLPPInterface_ProductionNominalMax_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_ProductionNominalMax_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *EgLPPInterface_ProductionNominalMax_Call) Return(f float64, err error) *EgLPPInterface_ProductionNominalMax_Call { - _c.Call.Return(f, err) +func (_c *EgLPPInterface_ProductionNominalMax_Call) Return(_a0 float64, _a1 error) *EgLPPInterface_ProductionNominalMax_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPPInterface_ProductionNominalMax_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *EgLPPInterface_ProductionNominalMax_Call { +func (_c *EgLPPInterface_ProductionNominalMax_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *EgLPPInterface_ProductionNominalMax_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *EgLPPInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api1.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api1.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -606,20 +553,19 @@ func (_c *EgLPPInterface_RemoteEntitiesScenarios_Call) Run(run func()) *EgLPPInt return _c } -func (_c *EgLPPInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *EgLPPInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *EgLPPInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *EgLPPInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *EgLPPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *EgLPPInterface_RemoteEntitiesScenarios_Call { +func (_c *EgLPPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *EgLPPInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *EgLPPInterface) RemoveUseCase() { + _m.Called() } // EgLPPInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -649,10 +595,9 @@ func (_c *EgLPPInterface_RemoveUseCase_Call) RunAndReturn(run func()) *EgLPPInte return _c } -// StartHeartbeat provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) StartHeartbeat() { - _mock.Called() - return +// StartHeartbeat provides a mock function with no fields +func (_m *EgLPPInterface) StartHeartbeat() { + _m.Called() } // EgLPPInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -682,10 +627,9 @@ func (_c *EgLPPInterface_StartHeartbeat_Call) RunAndReturn(run func()) *EgLPPInt return _c } -// StopHeartbeat provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) StopHeartbeat() { - _mock.Called() - return +// StopHeartbeat provides a mock function with no fields +func (_m *EgLPPInterface) StopHeartbeat() { + _m.Called() } // EgLPPInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -715,10 +659,9 @@ func (_c *EgLPPInterface_StopHeartbeat_Call) RunAndReturn(run func()) *EgLPPInte return _c } -// UpdateUseCaseAvailability provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *EgLPPInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // EgLPPInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -734,13 +677,7 @@ func (_e *EgLPPInterface_Expecter) UpdateUseCaseAvailability(available interface func (_c *EgLPPInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *EgLPPInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -750,14 +687,14 @@ func (_c *EgLPPInterface_UpdateUseCaseAvailability_Call) Return() *EgLPPInterfac return _c } -func (_c *EgLPPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *EgLPPInterface_UpdateUseCaseAvailability_Call { +func (_c *EgLPPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *EgLPPInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// WriteFailsafeDurationMinimum provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) WriteFailsafeDurationMinimum(entity api.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error) { - ret := _mock.Called(entity, duration) +// WriteFailsafeDurationMinimum provides a mock function with given fields: entity, duration +func (_m *EgLPPInterface) WriteFailsafeDurationMinimum(entity spine_goapi.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error) { + ret := _m.Called(entity, duration) if len(ret) == 0 { panic("no return value specified for WriteFailsafeDurationMinimum") @@ -765,21 +702,23 @@ func (_mock *EgLPPInterface) WriteFailsafeDurationMinimum(entity api.EntityRemot var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)); ok { - return returnFunc(entity, duration) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)); ok { + return rf(entity, duration) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, time.Duration) *model.MsgCounterType); ok { - r0 = returnFunc(entity, duration) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, time.Duration) *model.MsgCounterType); ok { + r0 = rf(entity, duration) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, time.Duration) error); ok { - r1 = returnFunc(entity, duration) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, time.Duration) error); ok { + r1 = rf(entity, duration) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -789,43 +728,32 @@ type EgLPPInterface_WriteFailsafeDurationMinimum_Call struct { } // WriteFailsafeDurationMinimum is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - duration time.Duration func (_e *EgLPPInterface_Expecter) WriteFailsafeDurationMinimum(entity interface{}, duration interface{}) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { return &EgLPPInterface_WriteFailsafeDurationMinimum_Call{Call: _e.mock.On("WriteFailsafeDurationMinimum", entity, duration)} } -func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) Run(run func(entity api.EntityRemoteInterface, duration time.Duration)) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { +func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, duration time.Duration)) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 time.Duration - if args[1] != nil { - arg1 = args[1].(time.Duration) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(time.Duration)) }) return _c } -func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { - _c.Call.Return(msgCounterType, err) +func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error)) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { +func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } -// WriteFailsafeProductionActivePowerLimit provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) WriteFailsafeProductionActivePowerLimit(entity api.EntityRemoteInterface, value float64) (*model.MsgCounterType, error) { - ret := _mock.Called(entity, value) +// WriteFailsafeProductionActivePowerLimit provides a mock function with given fields: entity, value +func (_m *EgLPPInterface) WriteFailsafeProductionActivePowerLimit(entity spine_goapi.EntityRemoteInterface, value float64) (*model.MsgCounterType, error) { + ret := _m.Called(entity, value) if len(ret) == 0 { panic("no return value specified for WriteFailsafeProductionActivePowerLimit") @@ -833,21 +761,23 @@ func (_mock *EgLPPInterface) WriteFailsafeProductionActivePowerLimit(entity api. var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, float64) (*model.MsgCounterType, error)); ok { - return returnFunc(entity, value) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, float64) (*model.MsgCounterType, error)); ok { + return rf(entity, value) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, float64) *model.MsgCounterType); ok { - r0 = returnFunc(entity, value) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, float64) *model.MsgCounterType); ok { + r0 = rf(entity, value) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, float64) error); ok { - r1 = returnFunc(entity, value) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, float64) error); ok { + r1 = rf(entity, value) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -857,43 +787,32 @@ type EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call struct { } // WriteFailsafeProductionActivePowerLimit is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - value float64 func (_e *EgLPPInterface_Expecter) WriteFailsafeProductionActivePowerLimit(entity interface{}, value interface{}) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { return &EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call{Call: _e.mock.On("WriteFailsafeProductionActivePowerLimit", entity, value)} } -func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) Run(run func(entity api.EntityRemoteInterface, value float64)) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { +func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, value float64)) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 float64 - if args[1] != nil { - arg1 = args[1].(float64) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(float64)) }) return _c } -func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { - _c.Call.Return(msgCounterType, err) +func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, value float64) (*model.MsgCounterType, error)) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { +func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, float64) (*model.MsgCounterType, error)) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// WriteProductionLimit provides a mock function for the type EgLPPInterface -func (_mock *EgLPPInterface) WriteProductionLimit(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error) { - ret := _mock.Called(entity, limit, resultCB) +// WriteProductionLimit provides a mock function with given fields: entity, limit, resultCB +func (_m *EgLPPInterface) WriteProductionLimit(entity spine_goapi.EntityRemoteInterface, limit api.LoadLimit, resultCB func(model.ResultDataType)) (*model.MsgCounterType, error) { + ret := _m.Called(entity, limit, resultCB) if len(ret) == 0 { panic("no return value specified for WriteProductionLimit") @@ -901,21 +820,23 @@ func (_mock *EgLPPInterface) WriteProductionLimit(entity api.EntityRemoteInterfa var r0 *model.MsgCounterType var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) (*model.MsgCounterType, error)); ok { - return returnFunc(entity, limit, resultCB) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) (*model.MsgCounterType, error)); ok { + return rf(entity, limit, resultCB) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) *model.MsgCounterType); ok { - r0 = returnFunc(entity, limit, resultCB) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) *model.MsgCounterType); ok { + r0 = rf(entity, limit, resultCB) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) error); ok { - r1 = returnFunc(entity, limit, resultCB) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) error); ok { + r1 = rf(entity, limit, resultCB) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -925,42 +846,40 @@ type EgLPPInterface_WriteProductionLimit_Call struct { } // WriteProductionLimit is a helper method to define mock.On call -// - entity api.EntityRemoteInterface -// - limit api0.LoadLimit -// - resultCB func(result model.ResultDataType) +// - entity spine_goapi.EntityRemoteInterface +// - limit api.LoadLimit +// - resultCB func(model.ResultDataType) func (_e *EgLPPInterface_Expecter) WriteProductionLimit(entity interface{}, limit interface{}, resultCB interface{}) *EgLPPInterface_WriteProductionLimit_Call { return &EgLPPInterface_WriteProductionLimit_Call{Call: _e.mock.On("WriteProductionLimit", entity, limit, resultCB)} } -func (_c *EgLPPInterface_WriteProductionLimit_Call) Run(run func(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType))) *EgLPPInterface_WriteProductionLimit_Call { +func (_c *EgLPPInterface_WriteProductionLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, limit api.LoadLimit, resultCB func(model.ResultDataType))) *EgLPPInterface_WriteProductionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 api0.LoadLimit - if args[1] != nil { - arg1 = args[1].(api0.LoadLimit) - } - var arg2 func(result model.ResultDataType) - if args[2] != nil { - arg2 = args[2].(func(result model.ResultDataType)) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(api.LoadLimit), args[2].(func(model.ResultDataType))) }) return _c } -func (_c *EgLPPInterface_WriteProductionLimit_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPPInterface_WriteProductionLimit_Call { - _c.Call.Return(msgCounterType, err) +func (_c *EgLPPInterface_WriteProductionLimit_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPPInterface_WriteProductionLimit_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *EgLPPInterface_WriteProductionLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error)) *EgLPPInterface_WriteProductionLimit_Call { +func (_c *EgLPPInterface_WriteProductionLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) (*model.MsgCounterType, error)) *EgLPPInterface_WriteProductionLimit_Call { _c.Call.Return(run) return _c } + +// NewEgLPPInterface creates a new instance of EgLPPInterface. 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 NewEgLPPInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *EgLPPInterface { + mock := &EgLPPInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/MaMGCPInterface.go b/usecases/mocks/MaMGCPInterface.go index e2e93db1..0b128cfd 100644 --- a/usecases/mocks/MaMGCPInterface.go +++ b/usecases/mocks/MaMGCPInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api0 "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/api" + eebus_goapi "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) -// NewMaMGCPInterface creates a new instance of MaMGCPInterface. 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 NewMaMGCPInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MaMGCPInterface { - mock := &MaMGCPInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // MaMGCPInterface is an autogenerated mock type for the MaMGCPInterface type type MaMGCPInterface struct { @@ -37,20 +22,21 @@ func (_m *MaMGCPInterface) EXPECT() *MaMGCPInterface_Expecter { return &MaMGCPInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *MaMGCPInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -71,8 +57,8 @@ func (_c *MaMGCPInterface_AddFeatures_Call) Run(run func()) *MaMGCPInterface_Add return _c } -func (_c *MaMGCPInterface_AddFeatures_Call) Return(err error) *MaMGCPInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *MaMGCPInterface_AddFeatures_Call) Return(_a0 error) *MaMGCPInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -81,10 +67,9 @@ func (_c *MaMGCPInterface_AddFeatures_Call) RunAndReturn(run func() error) *MaMG return _c } -// AddUseCase provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *MaMGCPInterface) AddUseCase() { + _m.Called() } // MaMGCPInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -114,22 +99,23 @@ func (_c *MaMGCPInterface_AddUseCase_Call) RunAndReturn(run func()) *MaMGCPInter return _c } -// AvailableScenariosForEntity provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *MaMGCPInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -139,37 +125,31 @@ type MaMGCPInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *MaMGCPInterface_AvailableScenariosForEntity_Call { return &MaMGCPInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_AvailableScenariosForEntity_Call { +func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *MaMGCPInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *MaMGCPInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *MaMGCPInterface_AvailableScenariosForEntity_Call { +func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *MaMGCPInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentPerPhase provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) CurrentPerPhase(entity api.EntityRemoteInterface) ([]float64, error) { - ret := _mock.Called(entity) +// CurrentPerPhase provides a mock function with given fields: entity +func (_m *MaMGCPInterface) CurrentPerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for CurrentPerPhase") @@ -177,21 +157,23 @@ func (_mock *MaMGCPInterface) CurrentPerPhase(entity api.EntityRemoteInterface) var r0 []float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -201,37 +183,31 @@ type MaMGCPInterface_CurrentPerPhase_Call struct { } // CurrentPerPhase is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) CurrentPerPhase(entity interface{}) *MaMGCPInterface_CurrentPerPhase_Call { return &MaMGCPInterface_CurrentPerPhase_Call{Call: _e.mock.On("CurrentPerPhase", entity)} } -func (_c *MaMGCPInterface_CurrentPerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_CurrentPerPhase_Call { +func (_c *MaMGCPInterface_CurrentPerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_CurrentPerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMGCPInterface_CurrentPerPhase_Call) Return(float64s []float64, err error) *MaMGCPInterface_CurrentPerPhase_Call { - _c.Call.Return(float64s, err) +func (_c *MaMGCPInterface_CurrentPerPhase_Call) Return(_a0 []float64, _a1 error) *MaMGCPInterface_CurrentPerPhase_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMGCPInterface_CurrentPerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *MaMGCPInterface_CurrentPerPhase_Call { +func (_c *MaMGCPInterface_CurrentPerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *MaMGCPInterface_CurrentPerPhase_Call { _c.Call.Return(run) return _c } -// EnergyConsumed provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) EnergyConsumed(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// EnergyConsumed provides a mock function with given fields: entity +func (_m *MaMGCPInterface) EnergyConsumed(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyConsumed") @@ -239,19 +215,21 @@ func (_mock *MaMGCPInterface) EnergyConsumed(entity api.EntityRemoteInterface) ( var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -261,37 +239,31 @@ type MaMGCPInterface_EnergyConsumed_Call struct { } // EnergyConsumed is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) EnergyConsumed(entity interface{}) *MaMGCPInterface_EnergyConsumed_Call { return &MaMGCPInterface_EnergyConsumed_Call{Call: _e.mock.On("EnergyConsumed", entity)} } -func (_c *MaMGCPInterface_EnergyConsumed_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_EnergyConsumed_Call { +func (_c *MaMGCPInterface_EnergyConsumed_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_EnergyConsumed_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMGCPInterface_EnergyConsumed_Call) Return(f float64, err error) *MaMGCPInterface_EnergyConsumed_Call { - _c.Call.Return(f, err) +func (_c *MaMGCPInterface_EnergyConsumed_Call) Return(_a0 float64, _a1 error) *MaMGCPInterface_EnergyConsumed_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMGCPInterface_EnergyConsumed_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_EnergyConsumed_Call { +func (_c *MaMGCPInterface_EnergyConsumed_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_EnergyConsumed_Call { _c.Call.Return(run) return _c } -// EnergyFeedIn provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) EnergyFeedIn(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// EnergyFeedIn provides a mock function with given fields: entity +func (_m *MaMGCPInterface) EnergyFeedIn(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyFeedIn") @@ -299,19 +271,21 @@ func (_mock *MaMGCPInterface) EnergyFeedIn(entity api.EntityRemoteInterface) (fl var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -321,37 +295,31 @@ type MaMGCPInterface_EnergyFeedIn_Call struct { } // EnergyFeedIn is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) EnergyFeedIn(entity interface{}) *MaMGCPInterface_EnergyFeedIn_Call { return &MaMGCPInterface_EnergyFeedIn_Call{Call: _e.mock.On("EnergyFeedIn", entity)} } -func (_c *MaMGCPInterface_EnergyFeedIn_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_EnergyFeedIn_Call { +func (_c *MaMGCPInterface_EnergyFeedIn_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_EnergyFeedIn_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMGCPInterface_EnergyFeedIn_Call) Return(f float64, err error) *MaMGCPInterface_EnergyFeedIn_Call { - _c.Call.Return(f, err) +func (_c *MaMGCPInterface_EnergyFeedIn_Call) Return(_a0 float64, _a1 error) *MaMGCPInterface_EnergyFeedIn_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMGCPInterface_EnergyFeedIn_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_EnergyFeedIn_Call { +func (_c *MaMGCPInterface_EnergyFeedIn_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_EnergyFeedIn_Call { _c.Call.Return(run) return _c } -// Frequency provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) Frequency(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// Frequency provides a mock function with given fields: entity +func (_m *MaMGCPInterface) Frequency(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for Frequency") @@ -359,19 +327,21 @@ func (_mock *MaMGCPInterface) Frequency(entity api.EntityRemoteInterface) (float var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -381,48 +351,43 @@ type MaMGCPInterface_Frequency_Call struct { } // Frequency is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) Frequency(entity interface{}) *MaMGCPInterface_Frequency_Call { return &MaMGCPInterface_Frequency_Call{Call: _e.mock.On("Frequency", entity)} } -func (_c *MaMGCPInterface_Frequency_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_Frequency_Call { +func (_c *MaMGCPInterface_Frequency_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_Frequency_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMGCPInterface_Frequency_Call) Return(f float64, err error) *MaMGCPInterface_Frequency_Call { - _c.Call.Return(f, err) +func (_c *MaMGCPInterface_Frequency_Call) Return(_a0 float64, _a1 error) *MaMGCPInterface_Frequency_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMGCPInterface_Frequency_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_Frequency_Call { +func (_c *MaMGCPInterface_Frequency_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_Frequency_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *MaMGCPInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -432,48 +397,43 @@ type MaMGCPInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) IsCompatibleEntityType(entity interface{}) *MaMGCPInterface_IsCompatibleEntityType_Call { return &MaMGCPInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_IsCompatibleEntityType_Call { +func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) Return(b bool) *MaMGCPInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *MaMGCPInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *MaMGCPInterface_IsCompatibleEntityType_Call { +func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *MaMGCPInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *MaMGCPInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -483,43 +443,32 @@ type MaMGCPInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *MaMGCPInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { return &MaMGCPInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// Power provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) Power(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// Power provides a mock function with given fields: entity +func (_m *MaMGCPInterface) Power(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for Power") @@ -527,19 +476,21 @@ func (_mock *MaMGCPInterface) Power(entity api.EntityRemoteInterface) (float64, var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -549,37 +500,31 @@ type MaMGCPInterface_Power_Call struct { } // Power is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) Power(entity interface{}) *MaMGCPInterface_Power_Call { return &MaMGCPInterface_Power_Call{Call: _e.mock.On("Power", entity)} } -func (_c *MaMGCPInterface_Power_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_Power_Call { +func (_c *MaMGCPInterface_Power_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_Power_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMGCPInterface_Power_Call) Return(f float64, err error) *MaMGCPInterface_Power_Call { - _c.Call.Return(f, err) +func (_c *MaMGCPInterface_Power_Call) Return(_a0 float64, _a1 error) *MaMGCPInterface_Power_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMGCPInterface_Power_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_Power_Call { +func (_c *MaMGCPInterface_Power_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_Power_Call { _c.Call.Return(run) return _c } -// PowerLimitationFactor provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) PowerLimitationFactor(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// PowerLimitationFactor provides a mock function with given fields: entity +func (_m *MaMGCPInterface) PowerLimitationFactor(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for PowerLimitationFactor") @@ -587,19 +532,21 @@ func (_mock *MaMGCPInterface) PowerLimitationFactor(entity api.EntityRemoteInter var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -609,50 +556,45 @@ type MaMGCPInterface_PowerLimitationFactor_Call struct { } // PowerLimitationFactor is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) PowerLimitationFactor(entity interface{}) *MaMGCPInterface_PowerLimitationFactor_Call { return &MaMGCPInterface_PowerLimitationFactor_Call{Call: _e.mock.On("PowerLimitationFactor", entity)} } -func (_c *MaMGCPInterface_PowerLimitationFactor_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_PowerLimitationFactor_Call { +func (_c *MaMGCPInterface_PowerLimitationFactor_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_PowerLimitationFactor_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMGCPInterface_PowerLimitationFactor_Call) Return(f float64, err error) *MaMGCPInterface_PowerLimitationFactor_Call { - _c.Call.Return(f, err) +func (_c *MaMGCPInterface_PowerLimitationFactor_Call) Return(_a0 float64, _a1 error) *MaMGCPInterface_PowerLimitationFactor_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMGCPInterface_PowerLimitationFactor_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_PowerLimitationFactor_Call { +func (_c *MaMGCPInterface_PowerLimitationFactor_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_PowerLimitationFactor_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *MaMGCPInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api0.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -673,20 +615,19 @@ func (_c *MaMGCPInterface_RemoteEntitiesScenarios_Call) Run(run func()) *MaMGCPI return _c } -func (_c *MaMGCPInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *MaMGCPInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *MaMGCPInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *MaMGCPInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *MaMGCPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *MaMGCPInterface_RemoteEntitiesScenarios_Call { +func (_c *MaMGCPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *MaMGCPInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *MaMGCPInterface) RemoveUseCase() { + _m.Called() } // MaMGCPInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -716,10 +657,9 @@ func (_c *MaMGCPInterface_RemoveUseCase_Call) RunAndReturn(run func()) *MaMGCPIn return _c } -// UpdateUseCaseAvailability provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *MaMGCPInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // MaMGCPInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -735,13 +675,7 @@ func (_e *MaMGCPInterface_Expecter) UpdateUseCaseAvailability(available interfac func (_c *MaMGCPInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *MaMGCPInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -751,14 +685,14 @@ func (_c *MaMGCPInterface_UpdateUseCaseAvailability_Call) Return() *MaMGCPInterf return _c } -func (_c *MaMGCPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *MaMGCPInterface_UpdateUseCaseAvailability_Call { +func (_c *MaMGCPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *MaMGCPInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// VoltagePerPhase provides a mock function for the type MaMGCPInterface -func (_mock *MaMGCPInterface) VoltagePerPhase(entity api.EntityRemoteInterface) ([]float64, error) { - ret := _mock.Called(entity) +// VoltagePerPhase provides a mock function with given fields: entity +func (_m *MaMGCPInterface) VoltagePerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for VoltagePerPhase") @@ -766,21 +700,23 @@ func (_mock *MaMGCPInterface) VoltagePerPhase(entity api.EntityRemoteInterface) var r0 []float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -790,30 +726,38 @@ type MaMGCPInterface_VoltagePerPhase_Call struct { } // VoltagePerPhase is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) VoltagePerPhase(entity interface{}) *MaMGCPInterface_VoltagePerPhase_Call { return &MaMGCPInterface_VoltagePerPhase_Call{Call: _e.mock.On("VoltagePerPhase", entity)} } -func (_c *MaMGCPInterface_VoltagePerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_VoltagePerPhase_Call { +func (_c *MaMGCPInterface_VoltagePerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_VoltagePerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMGCPInterface_VoltagePerPhase_Call) Return(float64s []float64, err error) *MaMGCPInterface_VoltagePerPhase_Call { - _c.Call.Return(float64s, err) +func (_c *MaMGCPInterface_VoltagePerPhase_Call) Return(_a0 []float64, _a1 error) *MaMGCPInterface_VoltagePerPhase_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMGCPInterface_VoltagePerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *MaMGCPInterface_VoltagePerPhase_Call { +func (_c *MaMGCPInterface_VoltagePerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *MaMGCPInterface_VoltagePerPhase_Call { _c.Call.Return(run) return _c } + +// NewMaMGCPInterface creates a new instance of MaMGCPInterface. 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 NewMaMGCPInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MaMGCPInterface { + mock := &MaMGCPInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/MaMPCInterface.go b/usecases/mocks/MaMPCInterface.go index 840ae2f4..0e6a4ea0 100644 --- a/usecases/mocks/MaMPCInterface.go +++ b/usecases/mocks/MaMPCInterface.go @@ -1,28 +1,13 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - api0 "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/api" + eebus_goapi "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" -) -// NewMaMPCInterface creates a new instance of MaMPCInterface. 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 NewMaMPCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MaMPCInterface { - mock := &MaMPCInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} + spine_goapi "github.com/enbility/spine-go/api" +) // MaMPCInterface is an autogenerated mock type for the MaMPCInterface type type MaMPCInterface struct { @@ -37,20 +22,21 @@ func (_m *MaMPCInterface) EXPECT() *MaMPCInterface_Expecter { return &MaMPCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) AddFeatures() error { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *MaMPCInterface) AddFeatures() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -71,8 +57,8 @@ func (_c *MaMPCInterface_AddFeatures_Call) Run(run func()) *MaMPCInterface_AddFe return _c } -func (_c *MaMPCInterface_AddFeatures_Call) Return(err error) *MaMPCInterface_AddFeatures_Call { - _c.Call.Return(err) +func (_c *MaMPCInterface_AddFeatures_Call) Return(_a0 error) *MaMPCInterface_AddFeatures_Call { + _c.Call.Return(_a0) return _c } @@ -81,10 +67,9 @@ func (_c *MaMPCInterface_AddFeatures_Call) RunAndReturn(run func() error) *MaMPC return _c } -// AddUseCase provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) AddUseCase() { - _mock.Called() - return +// AddUseCase provides a mock function with no fields +func (_m *MaMPCInterface) AddUseCase() { + _m.Called() } // MaMPCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -114,22 +99,23 @@ func (_c *MaMPCInterface_AddUseCase_Call) RunAndReturn(run func()) *MaMPCInterfa return _c } -// AvailableScenariosForEntity provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { - ret := _mock.Called(entity) +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *MaMPCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } + return r0 } @@ -139,37 +125,31 @@ type MaMPCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *MaMPCInterface_AvailableScenariosForEntity_Call { return &MaMPCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_AvailableScenariosForEntity_Call { +func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *MaMPCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(uints) +func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *MaMPCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *MaMPCInterface_AvailableScenariosForEntity_Call { +func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *MaMPCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentPerPhase provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) CurrentPerPhase(entity api.EntityRemoteInterface) ([]float64, error) { - ret := _mock.Called(entity) +// CurrentPerPhase provides a mock function with given fields: entity +func (_m *MaMPCInterface) CurrentPerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for CurrentPerPhase") @@ -177,21 +157,23 @@ func (_mock *MaMPCInterface) CurrentPerPhase(entity api.EntityRemoteInterface) ( var r0 []float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -201,37 +183,31 @@ type MaMPCInterface_CurrentPerPhase_Call struct { } // CurrentPerPhase is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) CurrentPerPhase(entity interface{}) *MaMPCInterface_CurrentPerPhase_Call { return &MaMPCInterface_CurrentPerPhase_Call{Call: _e.mock.On("CurrentPerPhase", entity)} } -func (_c *MaMPCInterface_CurrentPerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_CurrentPerPhase_Call { +func (_c *MaMPCInterface_CurrentPerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_CurrentPerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMPCInterface_CurrentPerPhase_Call) Return(float64s []float64, err error) *MaMPCInterface_CurrentPerPhase_Call { - _c.Call.Return(float64s, err) +func (_c *MaMPCInterface_CurrentPerPhase_Call) Return(_a0 []float64, _a1 error) *MaMPCInterface_CurrentPerPhase_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMPCInterface_CurrentPerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_CurrentPerPhase_Call { +func (_c *MaMPCInterface_CurrentPerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_CurrentPerPhase_Call { _c.Call.Return(run) return _c } -// EnergyConsumed provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) EnergyConsumed(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// EnergyConsumed provides a mock function with given fields: entity +func (_m *MaMPCInterface) EnergyConsumed(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyConsumed") @@ -239,19 +215,21 @@ func (_mock *MaMPCInterface) EnergyConsumed(entity api.EntityRemoteInterface) (f var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -261,37 +239,31 @@ type MaMPCInterface_EnergyConsumed_Call struct { } // EnergyConsumed is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) EnergyConsumed(entity interface{}) *MaMPCInterface_EnergyConsumed_Call { return &MaMPCInterface_EnergyConsumed_Call{Call: _e.mock.On("EnergyConsumed", entity)} } -func (_c *MaMPCInterface_EnergyConsumed_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_EnergyConsumed_Call { +func (_c *MaMPCInterface_EnergyConsumed_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_EnergyConsumed_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMPCInterface_EnergyConsumed_Call) Return(f float64, err error) *MaMPCInterface_EnergyConsumed_Call { - _c.Call.Return(f, err) +func (_c *MaMPCInterface_EnergyConsumed_Call) Return(_a0 float64, _a1 error) *MaMPCInterface_EnergyConsumed_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMPCInterface_EnergyConsumed_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMPCInterface_EnergyConsumed_Call { +func (_c *MaMPCInterface_EnergyConsumed_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMPCInterface_EnergyConsumed_Call { _c.Call.Return(run) return _c } -// EnergyProduced provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) EnergyProduced(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// EnergyProduced provides a mock function with given fields: entity +func (_m *MaMPCInterface) EnergyProduced(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyProduced") @@ -299,19 +271,21 @@ func (_mock *MaMPCInterface) EnergyProduced(entity api.EntityRemoteInterface) (f var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -321,37 +295,31 @@ type MaMPCInterface_EnergyProduced_Call struct { } // EnergyProduced is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) EnergyProduced(entity interface{}) *MaMPCInterface_EnergyProduced_Call { return &MaMPCInterface_EnergyProduced_Call{Call: _e.mock.On("EnergyProduced", entity)} } -func (_c *MaMPCInterface_EnergyProduced_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_EnergyProduced_Call { +func (_c *MaMPCInterface_EnergyProduced_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_EnergyProduced_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMPCInterface_EnergyProduced_Call) Return(f float64, err error) *MaMPCInterface_EnergyProduced_Call { - _c.Call.Return(f, err) +func (_c *MaMPCInterface_EnergyProduced_Call) Return(_a0 float64, _a1 error) *MaMPCInterface_EnergyProduced_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMPCInterface_EnergyProduced_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMPCInterface_EnergyProduced_Call { +func (_c *MaMPCInterface_EnergyProduced_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMPCInterface_EnergyProduced_Call { _c.Call.Return(run) return _c } -// Frequency provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) Frequency(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// Frequency provides a mock function with given fields: entity +func (_m *MaMPCInterface) Frequency(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for Frequency") @@ -359,19 +327,21 @@ func (_mock *MaMPCInterface) Frequency(entity api.EntityRemoteInterface) (float6 var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -381,48 +351,43 @@ type MaMPCInterface_Frequency_Call struct { } // Frequency is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) Frequency(entity interface{}) *MaMPCInterface_Frequency_Call { return &MaMPCInterface_Frequency_Call{Call: _e.mock.On("Frequency", entity)} } -func (_c *MaMPCInterface_Frequency_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_Frequency_Call { +func (_c *MaMPCInterface_Frequency_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_Frequency_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMPCInterface_Frequency_Call) Return(f float64, err error) *MaMPCInterface_Frequency_Call { - _c.Call.Return(f, err) +func (_c *MaMPCInterface_Frequency_Call) Return(_a0 float64, _a1 error) *MaMPCInterface_Frequency_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMPCInterface_Frequency_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMPCInterface_Frequency_Call { +func (_c *MaMPCInterface_Frequency_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMPCInterface_Frequency_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { - ret := _mock.Called(entity) +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *MaMPCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -432,48 +397,43 @@ type MaMPCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *MaMPCInterface_IsCompatibleEntityType_Call { return &MaMPCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *MaMPCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_IsCompatibleEntityType_Call { +func (_c *MaMPCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMPCInterface_IsCompatibleEntityType_Call) Return(b bool) *MaMPCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(b) +func (_c *MaMPCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *MaMPCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) return _c } -func (_c *MaMPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *MaMPCInterface_IsCompatibleEntityType_Call { +func (_c *MaMPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *MaMPCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { - ret := _mock.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *MaMPCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { - r0 = returnFunc(entity, scenario) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -483,43 +443,32 @@ type MaMPCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface // - scenario uint func (_e *MaMPCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { return &MaMPCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - var arg1 uint - if args[1] != nil { - arg1 = args[1].(uint) - } - run( - arg0, - arg1, - ) + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) }) return _c } -func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(b) +func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) return _c } -func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// Power provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) Power(entity api.EntityRemoteInterface) (float64, error) { - ret := _mock.Called(entity) +// Power provides a mock function with given fields: entity +func (_m *MaMPCInterface) Power(entity spine_goapi.EntityRemoteInterface) (float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for Power") @@ -527,19 +476,21 @@ func (_mock *MaMPCInterface) Power(entity api.EntityRemoteInterface) (float64, e var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { + r0 = rf(entity) } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -549,37 +500,31 @@ type MaMPCInterface_Power_Call struct { } // Power is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) Power(entity interface{}) *MaMPCInterface_Power_Call { return &MaMPCInterface_Power_Call{Call: _e.mock.On("Power", entity)} } -func (_c *MaMPCInterface_Power_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_Power_Call { +func (_c *MaMPCInterface_Power_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_Power_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMPCInterface_Power_Call) Return(f float64, err error) *MaMPCInterface_Power_Call { - _c.Call.Return(f, err) +func (_c *MaMPCInterface_Power_Call) Return(_a0 float64, _a1 error) *MaMPCInterface_Power_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMPCInterface_Power_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMPCInterface_Power_Call { +func (_c *MaMPCInterface_Power_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMPCInterface_Power_Call { _c.Call.Return(run) return _c } -// PowerPerPhase provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) PowerPerPhase(entity api.EntityRemoteInterface) ([]float64, error) { - ret := _mock.Called(entity) +// PowerPerPhase provides a mock function with given fields: entity +func (_m *MaMPCInterface) PowerPerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for PowerPerPhase") @@ -587,21 +532,23 @@ func (_mock *MaMPCInterface) PowerPerPhase(entity api.EntityRemoteInterface) ([] var r0 []float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -611,50 +558,45 @@ type MaMPCInterface_PowerPerPhase_Call struct { } // PowerPerPhase is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) PowerPerPhase(entity interface{}) *MaMPCInterface_PowerPerPhase_Call { return &MaMPCInterface_PowerPerPhase_Call{Call: _e.mock.On("PowerPerPhase", entity)} } -func (_c *MaMPCInterface_PowerPerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_PowerPerPhase_Call { +func (_c *MaMPCInterface_PowerPerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_PowerPerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMPCInterface_PowerPerPhase_Call) Return(float64s []float64, err error) *MaMPCInterface_PowerPerPhase_Call { - _c.Call.Return(float64s, err) +func (_c *MaMPCInterface_PowerPerPhase_Call) Return(_a0 []float64, _a1 error) *MaMPCInterface_PowerPerPhase_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMPCInterface_PowerPerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_PowerPerPhase_Call { +func (_c *MaMPCInterface_PowerPerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_PowerPerPhase_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { - ret := _mock.Called() +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *MaMPCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api0.RemoteEntityScenarios - if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { - r0 = returnFunc() + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api0.RemoteEntityScenarios) + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) } } + return r0 } @@ -675,20 +617,19 @@ func (_c *MaMPCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *MaMPCInt return _c } -func (_c *MaMPCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *MaMPCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(remoteEntityScenarioss) +func (_c *MaMPCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *MaMPCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) return _c } -func (_c *MaMPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *MaMPCInterface_RemoteEntitiesScenarios_Call { +func (_c *MaMPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *MaMPCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) RemoveUseCase() { - _mock.Called() - return +// RemoveUseCase provides a mock function with no fields +func (_m *MaMPCInterface) RemoveUseCase() { + _m.Called() } // MaMPCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -718,10 +659,9 @@ func (_c *MaMPCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *MaMPCInte return _c } -// UpdateUseCaseAvailability provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) UpdateUseCaseAvailability(available bool) { - _mock.Called(available) - return +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *MaMPCInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } // MaMPCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -737,13 +677,7 @@ func (_e *MaMPCInterface_Expecter) UpdateUseCaseAvailability(available interface func (_c *MaMPCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *MaMPCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 bool - if args[0] != nil { - arg0 = args[0].(bool) - } - run( - arg0, - ) + run(args[0].(bool)) }) return _c } @@ -753,14 +687,14 @@ func (_c *MaMPCInterface_UpdateUseCaseAvailability_Call) Return() *MaMPCInterfac return _c } -func (_c *MaMPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *MaMPCInterface_UpdateUseCaseAvailability_Call { +func (_c *MaMPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *MaMPCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// VoltagePerPhase provides a mock function for the type MaMPCInterface -func (_mock *MaMPCInterface) VoltagePerPhase(entity api.EntityRemoteInterface) ([]float64, error) { - ret := _mock.Called(entity) +// VoltagePerPhase provides a mock function with given fields: entity +func (_m *MaMPCInterface) VoltagePerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { + ret := _m.Called(entity) if len(ret) == 0 { panic("no return value specified for VoltagePerPhase") @@ -768,21 +702,23 @@ func (_mock *MaMPCInterface) VoltagePerPhase(entity api.EntityRemoteInterface) ( var r0 []float64 var r1 error - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { - return returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { + return rf(entity) } - if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { - r0 = returnFunc(entity) + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { + r0 = rf(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { - r1 = returnFunc(entity) + + if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { + r1 = rf(entity) } else { r1 = ret.Error(1) } + return r0, r1 } @@ -792,30 +728,38 @@ type MaMPCInterface_VoltagePerPhase_Call struct { } // VoltagePerPhase is a helper method to define mock.On call -// - entity api.EntityRemoteInterface +// - entity spine_goapi.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) VoltagePerPhase(entity interface{}) *MaMPCInterface_VoltagePerPhase_Call { return &MaMPCInterface_VoltagePerPhase_Call{Call: _e.mock.On("VoltagePerPhase", entity)} } -func (_c *MaMPCInterface_VoltagePerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_VoltagePerPhase_Call { +func (_c *MaMPCInterface_VoltagePerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_VoltagePerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 api.EntityRemoteInterface - if args[0] != nil { - arg0 = args[0].(api.EntityRemoteInterface) - } - run( - arg0, - ) + run(args[0].(spine_goapi.EntityRemoteInterface)) }) return _c } -func (_c *MaMPCInterface_VoltagePerPhase_Call) Return(float64s []float64, err error) *MaMPCInterface_VoltagePerPhase_Call { - _c.Call.Return(float64s, err) +func (_c *MaMPCInterface_VoltagePerPhase_Call) Return(_a0 []float64, _a1 error) *MaMPCInterface_VoltagePerPhase_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MaMPCInterface_VoltagePerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_VoltagePerPhase_Call { +func (_c *MaMPCInterface_VoltagePerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_VoltagePerPhase_Call { _c.Call.Return(run) return _c } + +// NewMaMPCInterface creates a new instance of MaMPCInterface. 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 NewMaMPCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MaMPCInterface { + mock := &MaMPCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/MuMPCInterface.go b/usecases/mocks/MuMPCInterface.go index 5cb2430f..6f343ea0 100644 --- a/usecases/mocks/MuMPCInterface.go +++ b/usecases/mocks/MuMPCInterface.go @@ -1,30 +1,19 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "time" + eebus_goapi "github.com/enbility/eebus-go/api" + api "github.com/enbility/eebus-go/usecases/api" - "github.com/enbility/eebus-go/usecases/api" - "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" -) -// NewMuMPCInterface creates a new instance of MuMPCInterface. 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 NewMuMPCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MuMPCInterface { - mock := &MuMPCInterface{} - mock.Mock.Test(t) + model "github.com/enbility/spine-go/model" - t.Cleanup(func() { mock.AssertExpectations(t) }) + spine_goapi "github.com/enbility/spine-go/api" - return mock -} + time "time" +) // MuMPCInterface is an autogenerated mock type for the MuMPCInterface type type MuMPCInterface struct { @@ -39,31 +28,158 @@ func (_m *MuMPCInterface) EXPECT() *MuMPCInterface_Expecter { return &MuMPCInterface_Expecter{mock: &_m.Mock} } -// CurrentPerPhase provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) CurrentPerPhase() ([]float64, error) { - ret := _mock.Called() +// AddFeatures provides a mock function with no fields +func (_m *MuMPCInterface) AddFeatures() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MuMPCInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' +type MuMPCInterface_AddFeatures_Call struct { + *mock.Call +} + +// AddFeatures is a helper method to define mock.On call +func (_e *MuMPCInterface_Expecter) AddFeatures() *MuMPCInterface_AddFeatures_Call { + return &MuMPCInterface_AddFeatures_Call{Call: _e.mock.On("AddFeatures")} +} + +func (_c *MuMPCInterface_AddFeatures_Call) Run(run func()) *MuMPCInterface_AddFeatures_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MuMPCInterface_AddFeatures_Call) Return(_a0 error) *MuMPCInterface_AddFeatures_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MuMPCInterface_AddFeatures_Call) RunAndReturn(run func() error) *MuMPCInterface_AddFeatures_Call { + _c.Call.Return(run) + return _c +} + +// AddUseCase provides a mock function with no fields +func (_m *MuMPCInterface) AddUseCase() { + _m.Called() +} + +// MuMPCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' +type MuMPCInterface_AddUseCase_Call struct { + *mock.Call +} + +// AddUseCase is a helper method to define mock.On call +func (_e *MuMPCInterface_Expecter) AddUseCase() *MuMPCInterface_AddUseCase_Call { + return &MuMPCInterface_AddUseCase_Call{Call: _e.mock.On("AddUseCase")} +} + +func (_c *MuMPCInterface_AddUseCase_Call) Run(run func()) *MuMPCInterface_AddUseCase_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MuMPCInterface_AddUseCase_Call) Return() *MuMPCInterface_AddUseCase_Call { + _c.Call.Return() + return _c +} + +func (_c *MuMPCInterface_AddUseCase_Call) RunAndReturn(run func()) *MuMPCInterface_AddUseCase_Call { + _c.Run(run) + return _c +} + +// AvailableScenariosForEntity provides a mock function with given fields: entity +func (_m *MuMPCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { + ret := _m.Called(entity) + + if len(ret) == 0 { + panic("no return value specified for AvailableScenariosForEntity") + } + + var r0 []uint + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { + r0 = rf(entity) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]uint) + } + } + + return r0 +} + +// MuMPCInterface_AvailableScenariosForEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AvailableScenariosForEntity' +type MuMPCInterface_AvailableScenariosForEntity_Call struct { + *mock.Call +} + +// AvailableScenariosForEntity is a helper method to define mock.On call +// - entity spine_goapi.EntityRemoteInterface +func (_e *MuMPCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *MuMPCInterface_AvailableScenariosForEntity_Call { + return &MuMPCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} +} + +func (_c *MuMPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MuMPCInterface_AvailableScenariosForEntity_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(spine_goapi.EntityRemoteInterface)) + }) + return _c +} + +func (_c *MuMPCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *MuMPCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MuMPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *MuMPCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(run) + return _c +} + +// CurrentPerPhase provides a mock function with no fields +func (_m *MuMPCInterface) CurrentPerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for CurrentPerPhase") } - var r0 []float64 + var r0 map[model.ElectricalConnectionPhaseNameType]float64 var r1 error - if returnFunc, ok := ret.Get(0).(func() ([]float64, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (map[model.ElectricalConnectionPhaseNameType]float64, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() []float64); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() map[model.ElectricalConnectionPhaseNameType]float64); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]float64) + r0 = ret.Get(0).(map[model.ElectricalConnectionPhaseNameType]float64) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -84,19 +200,19 @@ func (_c *MuMPCInterface_CurrentPerPhase_Call) Run(run func()) *MuMPCInterface_C return _c } -func (_c *MuMPCInterface_CurrentPerPhase_Call) Return(float64s []float64, err error) *MuMPCInterface_CurrentPerPhase_Call { - _c.Call.Return(float64s, err) +func (_c *MuMPCInterface_CurrentPerPhase_Call) Return(_a0 map[model.ElectricalConnectionPhaseNameType]float64, _a1 error) *MuMPCInterface_CurrentPerPhase_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MuMPCInterface_CurrentPerPhase_Call) RunAndReturn(run func() ([]float64, error)) *MuMPCInterface_CurrentPerPhase_Call { +func (_c *MuMPCInterface_CurrentPerPhase_Call) RunAndReturn(run func() (map[model.ElectricalConnectionPhaseNameType]float64, error)) *MuMPCInterface_CurrentPerPhase_Call { _c.Call.Return(run) return _c } -// EnergyConsumed provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) EnergyConsumed() (float64, error) { - ret := _mock.Called() +// EnergyConsumed provides a mock function with no fields +func (_m *MuMPCInterface) EnergyConsumed() (float64, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for EnergyConsumed") @@ -104,19 +220,21 @@ func (_mock *MuMPCInterface) EnergyConsumed() (float64, error) { var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (float64, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() float64); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() float64); ok { + r0 = rf() } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -137,8 +255,8 @@ func (_c *MuMPCInterface_EnergyConsumed_Call) Run(run func()) *MuMPCInterface_En return _c } -func (_c *MuMPCInterface_EnergyConsumed_Call) Return(f float64, err error) *MuMPCInterface_EnergyConsumed_Call { - _c.Call.Return(f, err) +func (_c *MuMPCInterface_EnergyConsumed_Call) Return(_a0 float64, _a1 error) *MuMPCInterface_EnergyConsumed_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -147,9 +265,9 @@ func (_c *MuMPCInterface_EnergyConsumed_Call) RunAndReturn(run func() (float64, return _c } -// EnergyProduced provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) EnergyProduced() (float64, error) { - ret := _mock.Called() +// EnergyProduced provides a mock function with no fields +func (_m *MuMPCInterface) EnergyProduced() (float64, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for EnergyProduced") @@ -157,19 +275,21 @@ func (_mock *MuMPCInterface) EnergyProduced() (float64, error) { var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (float64, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() float64); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() float64); ok { + r0 = rf() } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -190,8 +310,8 @@ func (_c *MuMPCInterface_EnergyProduced_Call) Run(run func()) *MuMPCInterface_En return _c } -func (_c *MuMPCInterface_EnergyProduced_Call) Return(f float64, err error) *MuMPCInterface_EnergyProduced_Call { - _c.Call.Return(f, err) +func (_c *MuMPCInterface_EnergyProduced_Call) Return(_a0 float64, _a1 error) *MuMPCInterface_EnergyProduced_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -200,9 +320,9 @@ func (_c *MuMPCInterface_EnergyProduced_Call) RunAndReturn(run func() (float64, return _c } -// Frequency provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) Frequency() (float64, error) { - ret := _mock.Called() +// Frequency provides a mock function with no fields +func (_m *MuMPCInterface) Frequency() (float64, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for Frequency") @@ -210,19 +330,21 @@ func (_mock *MuMPCInterface) Frequency() (float64, error) { var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (float64, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() float64); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() float64); ok { + r0 = rf() } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -243,8 +365,8 @@ func (_c *MuMPCInterface_Frequency_Call) Run(run func()) *MuMPCInterface_Frequen return _c } -func (_c *MuMPCInterface_Frequency_Call) Return(f float64, err error) *MuMPCInterface_Frequency_Call { - _c.Call.Return(f, err) +func (_c *MuMPCInterface_Frequency_Call) Return(_a0 float64, _a1 error) *MuMPCInterface_Frequency_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -253,9 +375,102 @@ func (_c *MuMPCInterface_Frequency_Call) RunAndReturn(run func() (float64, error return _c } -// Power provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) Power() (float64, error) { - ret := _mock.Called() +// IsCompatibleEntityType provides a mock function with given fields: entity +func (_m *MuMPCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { + ret := _m.Called(entity) + + if len(ret) == 0 { + panic("no return value specified for IsCompatibleEntityType") + } + + var r0 bool + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { + r0 = rf(entity) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// MuMPCInterface_IsCompatibleEntityType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsCompatibleEntityType' +type MuMPCInterface_IsCompatibleEntityType_Call struct { + *mock.Call +} + +// IsCompatibleEntityType is a helper method to define mock.On call +// - entity spine_goapi.EntityRemoteInterface +func (_e *MuMPCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *MuMPCInterface_IsCompatibleEntityType_Call { + return &MuMPCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} +} + +func (_c *MuMPCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MuMPCInterface_IsCompatibleEntityType_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(spine_goapi.EntityRemoteInterface)) + }) + return _c +} + +func (_c *MuMPCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *MuMPCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MuMPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *MuMPCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(run) + return _c +} + +// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario +func (_m *MuMPCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { + ret := _m.Called(entity, scenario) + + if len(ret) == 0 { + panic("no return value specified for IsScenarioAvailableAtEntity") + } + + var r0 bool + if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { + r0 = rf(entity, scenario) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// MuMPCInterface_IsScenarioAvailableAtEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsScenarioAvailableAtEntity' +type MuMPCInterface_IsScenarioAvailableAtEntity_Call struct { + *mock.Call +} + +// IsScenarioAvailableAtEntity is a helper method to define mock.On call +// - entity spine_goapi.EntityRemoteInterface +// - scenario uint +func (_e *MuMPCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *MuMPCInterface_IsScenarioAvailableAtEntity_Call { + return &MuMPCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} +} + +func (_c *MuMPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *MuMPCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + }) + return _c +} + +func (_c *MuMPCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *MuMPCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MuMPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *MuMPCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(run) + return _c +} + +// Power provides a mock function with no fields +func (_m *MuMPCInterface) Power() (float64, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for Power") @@ -263,19 +478,21 @@ func (_mock *MuMPCInterface) Power() (float64, error) { var r0 float64 var r1 error - if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (float64, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() float64); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() float64); ok { + r0 = rf() } else { r0 = ret.Get(0).(float64) } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -296,8 +513,8 @@ func (_c *MuMPCInterface_Power_Call) Run(run func()) *MuMPCInterface_Power_Call return _c } -func (_c *MuMPCInterface_Power_Call) Return(f float64, err error) *MuMPCInterface_Power_Call { - _c.Call.Return(f, err) +func (_c *MuMPCInterface_Power_Call) Return(_a0 float64, _a1 error) *MuMPCInterface_Power_Call { + _c.Call.Return(_a0, _a1) return _c } @@ -306,31 +523,33 @@ func (_c *MuMPCInterface_Power_Call) RunAndReturn(run func() (float64, error)) * return _c } -// PowerPerPhase provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) PowerPerPhase() ([]float64, error) { - ret := _mock.Called() +// PowerPerPhase provides a mock function with no fields +func (_m *MuMPCInterface) PowerPerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for PowerPerPhase") } - var r0 []float64 + var r0 map[model.ElectricalConnectionPhaseNameType]float64 var r1 error - if returnFunc, ok := ret.Get(0).(func() ([]float64, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (map[model.ElectricalConnectionPhaseNameType]float64, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() []float64); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() map[model.ElectricalConnectionPhaseNameType]float64); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]float64) + r0 = ret.Get(0).(map[model.ElectricalConnectionPhaseNameType]float64) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -351,36 +570,116 @@ func (_c *MuMPCInterface_PowerPerPhase_Call) Run(run func()) *MuMPCInterface_Pow return _c } -func (_c *MuMPCInterface_PowerPerPhase_Call) Return(float64s []float64, err error) *MuMPCInterface_PowerPerPhase_Call { - _c.Call.Return(float64s, err) +func (_c *MuMPCInterface_PowerPerPhase_Call) Return(_a0 map[model.ElectricalConnectionPhaseNameType]float64, _a1 error) *MuMPCInterface_PowerPerPhase_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MuMPCInterface_PowerPerPhase_Call) RunAndReturn(run func() ([]float64, error)) *MuMPCInterface_PowerPerPhase_Call { +func (_c *MuMPCInterface_PowerPerPhase_Call) RunAndReturn(run func() (map[model.ElectricalConnectionPhaseNameType]float64, error)) *MuMPCInterface_PowerPerPhase_Call { _c.Call.Return(run) return _c } -// Update provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) Update(data ...api.UpdateMeasurementData) error { - var tmpRet mock.Arguments - if len(data) > 0 { - tmpRet = _mock.Called(data) +// RemoteEntitiesScenarios provides a mock function with no fields +func (_m *MuMPCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for RemoteEntitiesScenarios") + } + + var r0 []eebus_goapi.RemoteEntityScenarios + if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { + r0 = rf() } else { - tmpRet = _mock.Called() + if ret.Get(0) != nil { + r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + } + } + + return r0 +} + +// MuMPCInterface_RemoteEntitiesScenarios_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoteEntitiesScenarios' +type MuMPCInterface_RemoteEntitiesScenarios_Call struct { + *mock.Call +} + +// RemoteEntitiesScenarios is a helper method to define mock.On call +func (_e *MuMPCInterface_Expecter) RemoteEntitiesScenarios() *MuMPCInterface_RemoteEntitiesScenarios_Call { + return &MuMPCInterface_RemoteEntitiesScenarios_Call{Call: _e.mock.On("RemoteEntitiesScenarios")} +} + +func (_c *MuMPCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *MuMPCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MuMPCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *MuMPCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MuMPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *MuMPCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(run) + return _c +} + +// RemoveUseCase provides a mock function with no fields +func (_m *MuMPCInterface) RemoveUseCase() { + _m.Called() +} + +// MuMPCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' +type MuMPCInterface_RemoveUseCase_Call struct { + *mock.Call +} + +// RemoveUseCase is a helper method to define mock.On call +func (_e *MuMPCInterface_Expecter) RemoveUseCase() *MuMPCInterface_RemoveUseCase_Call { + return &MuMPCInterface_RemoveUseCase_Call{Call: _e.mock.On("RemoveUseCase")} +} + +func (_c *MuMPCInterface_RemoveUseCase_Call) Run(run func()) *MuMPCInterface_RemoveUseCase_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MuMPCInterface_RemoveUseCase_Call) Return() *MuMPCInterface_RemoveUseCase_Call { + _c.Call.Return() + return _c +} + +func (_c *MuMPCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *MuMPCInterface_RemoveUseCase_Call { + _c.Run(run) + return _c +} + +// Update provides a mock function with given fields: data +func (_m *MuMPCInterface) Update(data ...api.UpdateMeasurementData) error { + _va := make([]interface{}, len(data)) + for _i := range data { + _va[_i] = data[_i] } - ret := tmpRet + var _ca []interface{} + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) if len(ret) == 0 { panic("no return value specified for Update") } var r0 error - if returnFunc, ok := ret.Get(0).(func(...api.UpdateMeasurementData) error); ok { - r0 = returnFunc(data...) + if rf, ok := ret.Get(0).(func(...api.UpdateMeasurementData) error); ok { + r0 = rf(data...) } else { r0 = ret.Error(0) } + return r0 } @@ -398,45 +697,44 @@ func (_e *MuMPCInterface_Expecter) Update(data ...interface{}) *MuMPCInterface_U func (_c *MuMPCInterface_Update_Call) Run(run func(data ...api.UpdateMeasurementData)) *MuMPCInterface_Update_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 []api.UpdateMeasurementData - var variadicArgs []api.UpdateMeasurementData - if len(args) > 0 { - variadicArgs = args[0].([]api.UpdateMeasurementData) + variadicArgs := make([]api.UpdateMeasurementData, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(api.UpdateMeasurementData) + } } - arg0 = variadicArgs - run( - arg0..., - ) + run(variadicArgs...) }) return _c } -func (_c *MuMPCInterface_Update_Call) Return(err error) *MuMPCInterface_Update_Call { - _c.Call.Return(err) +func (_c *MuMPCInterface_Update_Call) Return(_a0 error) *MuMPCInterface_Update_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_Update_Call) RunAndReturn(run func(data ...api.UpdateMeasurementData) error) *MuMPCInterface_Update_Call { +func (_c *MuMPCInterface_Update_Call) RunAndReturn(run func(...api.UpdateMeasurementData) error) *MuMPCInterface_Update_Call { _c.Call.Return(run) return _c } -// UpdateDataCurrentPhaseA provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataCurrentPhaseA provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataCurrentPhaseA") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -455,53 +753,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataCurrentPhaseA(value interface{}, ti func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { +func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { _c.Call.Return(run) return _c } -// UpdateDataCurrentPhaseB provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataCurrentPhaseB provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataCurrentPhaseB") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -520,53 +803,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataCurrentPhaseB(value interface{}, ti func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { +func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { _c.Call.Return(run) return _c } -// UpdateDataCurrentPhaseC provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataCurrentPhaseC provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataCurrentPhaseC") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -585,53 +853,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataCurrentPhaseC(value interface{}, ti func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { +func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { _c.Call.Return(run) return _c } -// UpdateDataEnergyConsumed provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataEnergyConsumed(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) +// UpdateDataEnergyConsumed provides a mock function with given fields: value, timestamp, valueState, evaluationStart, evaluationEnd +func (_m *MuMPCInterface) UpdateDataEnergyConsumed(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) if len(ret) == 0 { panic("no return value specified for UpdateDataEnergyConsumed") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState, evaluationStart, evaluationEnd) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState, evaluationStart, evaluationEnd) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -652,63 +905,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataEnergyConsumed(value interface{}, t func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time)) *MuMPCInterface_UpdateDataEnergyConsumed_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - var arg3 *time.Time - if args[3] != nil { - arg3 = args[3].(*time.Time) - } - var arg4 *time.Time - if args[4] != nil { - arg4 = args[4].(*time.Time) - } - run( - arg0, - arg1, - arg2, - arg3, - arg4, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType), args[3].(*time.Time), args[4].(*time.Time)) }) return _c } -func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { +func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { _c.Call.Return(run) return _c } -// UpdateDataEnergyProduced provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataEnergyProduced(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) +// UpdateDataEnergyProduced provides a mock function with given fields: value, timestamp, valueState, evaluationStart, evaluationEnd +func (_m *MuMPCInterface) UpdateDataEnergyProduced(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) if len(ret) == 0 { panic("no return value specified for UpdateDataEnergyProduced") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState, evaluationStart, evaluationEnd) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState, evaluationStart, evaluationEnd) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -729,63 +957,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataEnergyProduced(value interface{}, t func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time)) *MuMPCInterface_UpdateDataEnergyProduced_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - var arg3 *time.Time - if args[3] != nil { - arg3 = args[3].(*time.Time) - } - var arg4 *time.Time - if args[4] != nil { - arg4 = args[4].(*time.Time) - } - run( - arg0, - arg1, - arg2, - arg3, - arg4, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType), args[3].(*time.Time), args[4].(*time.Time)) }) return _c } -func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyProduced_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyProduced_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyProduced_Call { +func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyProduced_Call { _c.Call.Return(run) return _c } -// UpdateDataFrequency provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataFrequency provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataFrequency") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -804,53 +1007,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataFrequency(value interface{}, timest func (_c *MuMPCInterface_UpdateDataFrequency_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataFrequency_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataFrequency_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataFrequency_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataFrequency_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataFrequency_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataFrequency_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataFrequency_Call { +func (_c *MuMPCInterface_UpdateDataFrequency_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataFrequency_Call { _c.Call.Return(run) return _c } -// UpdateDataPowerPhaseA provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataPowerPhaseA provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerPhaseA") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -869,53 +1057,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataPowerPhaseA(value interface{}, time func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerPhaseA_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { +func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { _c.Call.Return(run) return _c } -// UpdateDataPowerPhaseB provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataPowerPhaseB provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerPhaseB") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -934,53 +1107,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataPowerPhaseB(value interface{}, time func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerPhaseB_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { +func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { _c.Call.Return(run) return _c } -// UpdateDataPowerPhaseC provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataPowerPhaseC provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerPhaseC") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -999,53 +1157,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataPowerPhaseC(value interface{}, time func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerPhaseC_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { +func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { _c.Call.Return(run) return _c } -// UpdateDataPowerTotal provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataPowerTotal provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerTotal") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -1064,53 +1207,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataPowerTotal(value interface{}, times func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerTotal_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerTotal_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerTotal_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerTotal_Call { +func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerTotal_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseA provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataVoltagePhaseA provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseA") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -1129,53 +1257,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseA(value interface{}, ti func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseAToB provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataVoltagePhaseAToB provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseAToB") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -1194,53 +1307,88 @@ func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseAToB(value interface{}, func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + }) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseAToC provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataVoltagePhaseAToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseAToC") + } + + var r0 api.UpdateMeasurementData + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.UpdateMeasurementData) } - run( - arg0, - arg1, - arg2, - ) + } + + return r0 +} + +// MuMPCInterface_UpdateDataVoltagePhaseAToC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseAToC' +type MuMPCInterface_UpdateDataVoltagePhaseAToC_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseAToC is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseAToC(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call { + return &MuMPCInterface_UpdateDataVoltagePhaseAToC_Call{Call: _e.mock.On("UpdateDataVoltagePhaseAToC", value, timestamp, valueState)} +} + +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseB provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataVoltagePhaseB provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseB") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -1259,53 +1407,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseB(value interface{}, ti func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseBToC provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataVoltagePhaseBToC provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseBToC") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -1324,53 +1457,38 @@ func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseBToC(value interface{}, func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseC provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) +// UpdateDataVoltagePhaseC provides a mock function with given fields: value, timestamp, valueState +func (_m *MuMPCInterface) UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { + ret := _m.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseC") } var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) + if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { + r0 = rf(value, timestamp, valueState) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(api.UpdateMeasurementData) } } + return r0 } @@ -1389,127 +1507,81 @@ func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseC(value interface{}, ti func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { + _c.Call.Return(_a0) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseCToA provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _mock.Called(value, timestamp, valueState) - - if len(ret) == 0 { - panic("no return value specified for UpdateDataVoltagePhaseCToA") - } - - var r0 api.UpdateMeasurementData - if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = returnFunc(value, timestamp, valueState) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) - } - } - return r0 +// UpdateUseCaseAvailability provides a mock function with given fields: available +func (_m *MuMPCInterface) UpdateUseCaseAvailability(available bool) { + _m.Called(available) } -// MuMPCInterface_UpdateDataVoltagePhaseCToA_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseCToA' -type MuMPCInterface_UpdateDataVoltagePhaseCToA_Call struct { +// MuMPCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' +type MuMPCInterface_UpdateUseCaseAvailability_Call struct { *mock.Call } -// UpdateDataVoltagePhaseCToA is a helper method to define mock.On call -// - value float64 -// - timestamp *time.Time -// - valueState *model.MeasurementValueStateType -func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseCToA(value interface{}, timestamp interface{}, valueState interface{}) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { - return &MuMPCInterface_UpdateDataVoltagePhaseCToA_Call{Call: _e.mock.On("UpdateDataVoltagePhaseCToA", value, timestamp, valueState)} +// UpdateUseCaseAvailability is a helper method to define mock.On call +// - available bool +func (_e *MuMPCInterface_Expecter) UpdateUseCaseAvailability(available interface{}) *MuMPCInterface_UpdateUseCaseAvailability_Call { + return &MuMPCInterface_UpdateUseCaseAvailability_Call{Call: _e.mock.On("UpdateUseCaseAvailability", available)} } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { +func (_c *MuMPCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *MuMPCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - var arg0 float64 - if args[0] != nil { - arg0 = args[0].(float64) - } - var arg1 *time.Time - if args[1] != nil { - arg1 = args[1].(*time.Time) - } - var arg2 *model.MeasurementValueStateType - if args[2] != nil { - arg2 = args[2].(*model.MeasurementValueStateType) - } - run( - arg0, - arg1, - arg2, - ) + run(args[0].(bool)) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call) Return(updateMeasurementData api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { - _c.Call.Return(updateMeasurementData) +func (_c *MuMPCInterface_UpdateUseCaseAvailability_Call) Return() *MuMPCInterface_UpdateUseCaseAvailability_Call { + _c.Call.Return() return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseCToA_Call { - _c.Call.Return(run) +func (_c *MuMPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *MuMPCInterface_UpdateUseCaseAvailability_Call { + _c.Run(run) return _c } -// VoltagePerPhase provides a mock function for the type MuMPCInterface -func (_mock *MuMPCInterface) VoltagePerPhase() ([]float64, error) { - ret := _mock.Called() +// VoltagePerPhase provides a mock function with no fields +func (_m *MuMPCInterface) VoltagePerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for VoltagePerPhase") } - var r0 []float64 + var r0 map[model.ElectricalConnectionPhaseNameType]float64 var r1 error - if returnFunc, ok := ret.Get(0).(func() ([]float64, error)); ok { - return returnFunc() + if rf, ok := ret.Get(0).(func() (map[model.ElectricalConnectionPhaseNameType]float64, error)); ok { + return rf() } - if returnFunc, ok := ret.Get(0).(func() []float64); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() map[model.ElectricalConnectionPhaseNameType]float64); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]float64) + r0 = ret.Get(0).(map[model.ElectricalConnectionPhaseNameType]float64) } } - if returnFunc, ok := ret.Get(1).(func() error); ok { - r1 = returnFunc() + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() } else { r1 = ret.Error(1) } + return r0, r1 } @@ -1530,12 +1602,26 @@ func (_c *MuMPCInterface_VoltagePerPhase_Call) Run(run func()) *MuMPCInterface_V return _c } -func (_c *MuMPCInterface_VoltagePerPhase_Call) Return(float64s []float64, err error) *MuMPCInterface_VoltagePerPhase_Call { - _c.Call.Return(float64s, err) +func (_c *MuMPCInterface_VoltagePerPhase_Call) Return(_a0 map[model.ElectricalConnectionPhaseNameType]float64, _a1 error) *MuMPCInterface_VoltagePerPhase_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *MuMPCInterface_VoltagePerPhase_Call) RunAndReturn(run func() ([]float64, error)) *MuMPCInterface_VoltagePerPhase_Call { +func (_c *MuMPCInterface_VoltagePerPhase_Call) RunAndReturn(run func() (map[model.ElectricalConnectionPhaseNameType]float64, error)) *MuMPCInterface_VoltagePerPhase_Call { _c.Call.Return(run) return _c } + +// NewMuMPCInterface creates a new instance of MuMPCInterface. 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 NewMuMPCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MuMPCInterface { + mock := &MuMPCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/UpdateData.go b/usecases/mocks/UpdateData.go index 126bcac6..089ea29e 100644 --- a/usecases/mocks/UpdateData.go +++ b/usecases/mocks/UpdateData.go @@ -1,26 +1,8 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks -import ( - mock "github.com/stretchr/testify/mock" -) - -// NewUpdateData creates a new instance of UpdateData. 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 NewUpdateData(t interface { - mock.TestingT - Cleanup(func()) -}) *UpdateData { - mock := &UpdateData{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} +import mock "github.com/stretchr/testify/mock" // UpdateData is an autogenerated mock type for the UpdateData type type UpdateData struct { @@ -35,20 +17,21 @@ func (_m *UpdateData) EXPECT() *UpdateData_Expecter { return &UpdateData_Expecter{mock: &_m.Mock} } -// NotSupportedError provides a mock function for the type UpdateData -func (_mock *UpdateData) NotSupportedError() error { - ret := _mock.Called() +// NotSupportedError provides a mock function with no fields +func (_m *UpdateData) NotSupportedError() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for NotSupportedError") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -69,8 +52,8 @@ func (_c *UpdateData_NotSupportedError_Call) Run(run func()) *UpdateData_NotSupp return _c } -func (_c *UpdateData_NotSupportedError_Call) Return(err error) *UpdateData_NotSupportedError_Call { - _c.Call.Return(err) +func (_c *UpdateData_NotSupportedError_Call) Return(_a0 error) *UpdateData_NotSupportedError_Call { + _c.Call.Return(_a0) return _c } @@ -79,20 +62,21 @@ func (_c *UpdateData_NotSupportedError_Call) RunAndReturn(run func() error) *Upd return _c } -// Supported provides a mock function for the type UpdateData -func (_mock *UpdateData) Supported() bool { - ret := _mock.Called() +// Supported provides a mock function with no fields +func (_m *UpdateData) Supported() bool { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for Supported") } var r0 bool - if returnFunc, ok := ret.Get(0).(func() bool); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -113,8 +97,8 @@ func (_c *UpdateData_Supported_Call) Run(run func()) *UpdateData_Supported_Call return _c } -func (_c *UpdateData_Supported_Call) Return(b bool) *UpdateData_Supported_Call { - _c.Call.Return(b) +func (_c *UpdateData_Supported_Call) Return(_a0 bool) *UpdateData_Supported_Call { + _c.Call.Return(_a0) return _c } @@ -122,3 +106,17 @@ func (_c *UpdateData_Supported_Call) RunAndReturn(run func() bool) *UpdateData_S _c.Call.Return(run) return _c } + +// NewUpdateData creates a new instance of UpdateData. 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 NewUpdateData(t interface { + mock.TestingT + Cleanup(func()) +}) *UpdateData { + mock := &UpdateData{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mocks/UpdateMeasurementData.go b/usecases/mocks/UpdateMeasurementData.go index cd750857..7185d141 100644 --- a/usecases/mocks/UpdateMeasurementData.go +++ b/usecases/mocks/UpdateMeasurementData.go @@ -1,28 +1,12 @@ -// Code generated by mockery; DO NOT EDIT. -// github.com/vektra/mockery -// template: testify +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks import ( - "github.com/enbility/eebus-go/api" + api "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" ) -// NewUpdateMeasurementData creates a new instance of UpdateMeasurementData. 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 NewUpdateMeasurementData(t interface { - mock.TestingT - Cleanup(func()) -}) *UpdateMeasurementData { - mock := &UpdateMeasurementData{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} - // UpdateMeasurementData is an autogenerated mock type for the UpdateMeasurementData type type UpdateMeasurementData struct { mock.Mock @@ -36,20 +20,21 @@ func (_m *UpdateMeasurementData) EXPECT() *UpdateMeasurementData_Expecter { return &UpdateMeasurementData_Expecter{mock: &_m.Mock} } -// MeasurementData provides a mock function for the type UpdateMeasurementData -func (_mock *UpdateMeasurementData) MeasurementData() api.MeasurementDataForID { - ret := _mock.Called() +// MeasurementData provides a mock function with no fields +func (_m *UpdateMeasurementData) MeasurementData() api.MeasurementDataForID { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for MeasurementData") } var r0 api.MeasurementDataForID - if returnFunc, ok := ret.Get(0).(func() api.MeasurementDataForID); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() api.MeasurementDataForID); ok { + r0 = rf() } else { r0 = ret.Get(0).(api.MeasurementDataForID) } + return r0 } @@ -70,8 +55,8 @@ func (_c *UpdateMeasurementData_MeasurementData_Call) Run(run func()) *UpdateMea return _c } -func (_c *UpdateMeasurementData_MeasurementData_Call) Return(measurementDataForID api.MeasurementDataForID) *UpdateMeasurementData_MeasurementData_Call { - _c.Call.Return(measurementDataForID) +func (_c *UpdateMeasurementData_MeasurementData_Call) Return(_a0 api.MeasurementDataForID) *UpdateMeasurementData_MeasurementData_Call { + _c.Call.Return(_a0) return _c } @@ -80,20 +65,21 @@ func (_c *UpdateMeasurementData_MeasurementData_Call) RunAndReturn(run func() ap return _c } -// NotSupportedError provides a mock function for the type UpdateMeasurementData -func (_mock *UpdateMeasurementData) NotSupportedError() error { - ret := _mock.Called() +// NotSupportedError provides a mock function with no fields +func (_m *UpdateMeasurementData) NotSupportedError() error { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for NotSupportedError") } var r0 error - if returnFunc, ok := ret.Get(0).(func() error); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() } else { r0 = ret.Error(0) } + return r0 } @@ -114,8 +100,8 @@ func (_c *UpdateMeasurementData_NotSupportedError_Call) Run(run func()) *UpdateM return _c } -func (_c *UpdateMeasurementData_NotSupportedError_Call) Return(err error) *UpdateMeasurementData_NotSupportedError_Call { - _c.Call.Return(err) +func (_c *UpdateMeasurementData_NotSupportedError_Call) Return(_a0 error) *UpdateMeasurementData_NotSupportedError_Call { + _c.Call.Return(_a0) return _c } @@ -124,20 +110,21 @@ func (_c *UpdateMeasurementData_NotSupportedError_Call) RunAndReturn(run func() return _c } -// Supported provides a mock function for the type UpdateMeasurementData -func (_mock *UpdateMeasurementData) Supported() bool { - ret := _mock.Called() +// Supported provides a mock function with no fields +func (_m *UpdateMeasurementData) Supported() bool { + ret := _m.Called() if len(ret) == 0 { panic("no return value specified for Supported") } var r0 bool - if returnFunc, ok := ret.Get(0).(func() bool); ok { - r0 = returnFunc() + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() } else { r0 = ret.Get(0).(bool) } + return r0 } @@ -158,8 +145,8 @@ func (_c *UpdateMeasurementData_Supported_Call) Run(run func()) *UpdateMeasureme return _c } -func (_c *UpdateMeasurementData_Supported_Call) Return(b bool) *UpdateMeasurementData_Supported_Call { - _c.Call.Return(b) +func (_c *UpdateMeasurementData_Supported_Call) Return(_a0 bool) *UpdateMeasurementData_Supported_Call { + _c.Call.Return(_a0) return _c } @@ -167,3 +154,17 @@ func (_c *UpdateMeasurementData_Supported_Call) RunAndReturn(run func() bool) *U _c.Call.Return(run) return _c } + +// NewUpdateMeasurementData creates a new instance of UpdateMeasurementData. 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 NewUpdateMeasurementData(t interface { + mock.TestingT + Cleanup(func()) +}) *UpdateMeasurementData { + mock := &UpdateMeasurementData{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/usecases/mu/mpc/config.go b/usecases/mu/mpc/config.go index 9b5314c1..52a1bbec 100644 --- a/usecases/mu/mpc/config.go +++ b/usecases/mu/mpc/config.go @@ -6,32 +6,19 @@ import ( "github.com/enbility/spine-go/model" ) -type ConnectedPhases string - -const ( - ConnectedPhasesA ConnectedPhases = "a" - ConnectedPhasesB ConnectedPhases = "b" - ConnectedPhasesC ConnectedPhases = "c" - ConnectedPhasesAB ConnectedPhases = "ab" - ConnectedPhasesBC ConnectedPhases = "bc" - ConnectedPhasesCA ConnectedPhases = "ac" - ConnectedPhasesABC ConnectedPhases = "abc" -) +type PhaseMeasurementSourceMap map[model.ElectricalConnectionPhaseNameType]*model.MeasurementValueSourceType +type PhaseMeasurementConstraintsMap map[model.ElectricalConnectionPhaseNameType]*model.MeasurementConstraintsDataType // MonitorPowerConfig is the configuration for the monitor use case // This config is required by the mpc use case and must be used in mpc.NewMPC type MonitorPowerConfig struct { - ConnectedPhases ConnectedPhases // The phases that are measured + ConnectedPhases model.ElectricalConnectionPhaseNameType // The phases that are measured - ValueSourceTotal *model.MeasurementValueSourceType // The source of the values from the acPowerTotal (required) - ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values from the acPower for phase A (required if the phase is supported) - ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values from the acPower for phase B (required if the phase is supported) - ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values from the acPower for phase C (required if the phase is supported) + ValueSourceTotal *model.MeasurementValueSourceType // The source of the values from the acPowerTotal (required) + ValueSourcePerPhase PhaseMeasurementSourceMap // The source of the values from the acPower per phase (required if the phase is supported) - ValueConstraintsTotal *model.MeasurementConstraintsDataType // The constraints for the acPowerTotal (optional can be nil) - ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the acPower for phase A (optional can be nil) - ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the acPower for phase B (optional can be nil) - ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the acPower for phase C (optional can be nil) + ValueConstraintsTotal *model.MeasurementConstraintsDataType // The constraints for the acPowerTotal (optional can be nil) + ValueConstraintsPerPhase PhaseMeasurementConstraintsMap // The constraints for the acPower per phase (optional can be nil) } // MonitorEnergyConfig is the configuration for the monitor use case @@ -48,35 +35,16 @@ type MonitorEnergyConfig struct { // If this config is passed via NewMPC, the use case will support current monitoring // The current phases will be the same as specified in MonitorPowerConfig type MonitorCurrentConfig struct { - ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values for phase A (required if the phase is supported) - ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values for phase B (required if the phase is supported) - ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values for phase C (required if the phase is supported) - - ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the current for phase A (optional can be nil) (requires ValueSourcePhaseA to be set) - ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the current for phase B (optional can be nil) (requires ValueSourcePhaseB to be set) - ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the current for phase C (optional can be nil) (requires ValueSourcePhaseC to be set) + ValueSourcePerPhase PhaseMeasurementSourceMap // The source of the values per phase (required if the phase is supported) + ValueConstraintsPerPhase PhaseMeasurementConstraintsMap // The constraints for the current per phase (optional can be nil) (requires ValueSourcePerPhase to be set) } // MonitorVoltageConfig is the configuration for the monitor use case // If this config is passed via NewMPC, the use case will support voltage monitoring // The voltage phases will be the same as specified in MonitorPowerConfig type MonitorVoltageConfig struct { - ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values for phase A (required if the phase is supported) - ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values for phase B (required if the phase is supported) - ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values for phase C (required if the phase is supported) - - ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the voltage for phase A (optional can be nil) (requires ValueSourcePhaseA to be set) - ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the voltage for phase B (optional can be nil) (requires ValueSourcePhaseB to be set) - ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the voltage for phase C (optional can be nil) (requires ValueSourcePhaseC to be set) - - SupportPhaseToPhase bool // Set to true if the use case supports phase to phase voltage monitoring - ValueSourcePhaseAToB *model.MeasurementValueSourceType // The source of the values for phase A to B (required if the phases are supported and SupportPhaseToPhase is true) - ValueSourcePhaseBToC *model.MeasurementValueSourceType // The source of the values for phase B to C (required if the phases are supported and SupportPhaseToPhase is true) - ValueSourcePhaseCToA *model.MeasurementValueSourceType // The source of the values for phase C to A (required if the phases are supported and SupportPhaseToPhase is true) - - ValueConstraintsPhaseAToB *model.MeasurementConstraintsDataType // The constraints for the voltage for phase A to B (optional can be nil) (requires ValueSourcePhaseAToB to be set) - ValueConstraintsPhaseBToC *model.MeasurementConstraintsDataType // The constraints for the voltage for phase B to C (optional can be nil) (requires ValueSourcePhaseBToC to be set) - ValueConstraintsPhaseCToA *model.MeasurementConstraintsDataType // The constraints for the voltage for phase C to A (optional can be nil) (requires ValueSourcePhaseCToA to be set) + ValueSourcePerPhase PhaseMeasurementSourceMap // The source of the values per phase (required if the phase is supported) + ValueConstraintsPerPhase PhaseMeasurementConstraintsMap // The constraints for the voltage per phase (optional can be nil) (requires ValueSourcePerPhase to be set) } // MonitorFrequencyConfig is the configuration for the monitor use case diff --git a/usecases/mu/mpc/config_test.go b/usecases/mu/mpc/config_test.go index 10d04777..8df2279f 100644 --- a/usecases/mu/mpc/config_test.go +++ b/usecases/mu/mpc/config_test.go @@ -1,18 +1,19 @@ package mpc import ( + "github.com/enbility/spine-go/model" "github.com/stretchr/testify/assert" ) func (s *MuMPCSuite) Test_SupportsPhases() { - allowedConstellations := map[ConnectedPhases][][]string{ - ConnectedPhasesA: {{"a"}}, - ConnectedPhasesB: {{"b"}}, - ConnectedPhasesC: {{"C"}}, - ConnectedPhasesAB: {{"a"}, {"b"}, {"a", "b"}}, - ConnectedPhasesBC: {{"b"}, {"c"}, {"B", "c"}}, - ConnectedPhasesCA: {{"a"}, {"c"}, {"A", "C"}}, - ConnectedPhasesABC: {{"a"}, {"b"}, {"c"}, {"a", "b"}, {"b", "c"}, {"a", "c"}, {"A", "b", "c"}}, + allowedConstellations := map[model.ElectricalConnectionPhaseNameType][][]string{ + model.ElectricalConnectionPhaseNameTypeA: {{"a"}}, + model.ElectricalConnectionPhaseNameTypeB: {{"b"}}, + model.ElectricalConnectionPhaseNameTypeC: {{"C"}}, + model.ElectricalConnectionPhaseNameTypeAb: {{"a"}, {"b"}, {"a", "b"}}, + model.ElectricalConnectionPhaseNameTypeBc: {{"b"}, {"c"}, {"B", "c"}}, + model.ElectricalConnectionPhaseNameTypeAc: {{"a"}, {"c"}, {"A", "C"}}, + model.ElectricalConnectionPhaseNameTypeAbc: {{"a"}, {"b"}, {"c"}, {"a", "b"}, {"b", "c"}, {"a", "c"}, {"A", "b", "c"}}, } for constellation, phases := range allowedConstellations { @@ -25,13 +26,13 @@ func (s *MuMPCSuite) Test_SupportsPhases() { } } - notAllowedConstellations := map[ConnectedPhases][]string{ - ConnectedPhasesA: {"b", "c", "ab", "bc", "ac", "abc"}, - ConnectedPhasesB: {"a", "c", "ab", "bc", "ac", "abc"}, - ConnectedPhasesC: {"a", "b", "ab", "bc", "ac", "abc"}, - ConnectedPhasesAB: {"c", "ac", "abc"}, - ConnectedPhasesBC: {"a", "ab", "abc"}, - ConnectedPhasesCA: {"b", "bc", "abc"}, + notAllowedConstellations := map[model.ElectricalConnectionPhaseNameType][]string{ + model.ElectricalConnectionPhaseNameTypeA: {"b", "c", "ab", "bc", "ac", "abc"}, + model.ElectricalConnectionPhaseNameTypeB: {"a", "c", "ab", "bc", "ac", "abc"}, + model.ElectricalConnectionPhaseNameTypeC: {"a", "b", "ab", "bc", "ac", "abc"}, + model.ElectricalConnectionPhaseNameTypeAb: {"c", "ac", "abc"}, + model.ElectricalConnectionPhaseNameTypeBc: {"a", "ab", "abc"}, + model.ElectricalConnectionPhaseNameTypeAc: {"b", "bc", "abc"}, } for constellation, notSupportedPhases := range notAllowedConstellations { diff --git a/usecases/mu/mpc/public.go b/usecases/mu/mpc/public.go index 2f2d003c..01c2415a 100644 --- a/usecases/mu/mpc/public.go +++ b/usecases/mu/mpc/public.go @@ -31,16 +31,16 @@ func (e *MPC) Power() (float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (e *MPC) PowerPerPhase() ([]float64, error) { - powerPerPhase := make([]float64, 0) +func (e *MPC) PowerPerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { + powerPerPhase := make(map[model.ElectricalConnectionPhaseNameType]float64) - for _, id := range e.acPower { + for phase, id := range e.acPowerPerPhase { if id != nil { power, err := e.getMeasurementDataForId(id) if err != nil { return nil, err } - powerPerPhase = append(powerPerPhase, power) + powerPerPhase[phase] = power } } @@ -89,16 +89,16 @@ func (e *MPC) EnergyProduced() (float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (e *MPC) CurrentPerPhase() ([]float64, error) { - currentPerPhase := make([]float64, 0) +func (e *MPC) CurrentPerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { + currentPerPhase := make(map[model.ElectricalConnectionPhaseNameType]float64) - for _, id := range e.acCurrent { + for phase, id := range e.acCurrentPerPhase { if id != nil { current, err := e.getMeasurementDataForId(id) if err != nil { return nil, err } - currentPerPhase = append(currentPerPhase, current) + currentPerPhase[phase] = current } } @@ -112,16 +112,16 @@ func (e *MPC) CurrentPerPhase() ([]float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (e *MPC) VoltagePerPhase() ([]float64, error) { - voltagePerPhase := make([]float64, 0) +func (e *MPC) VoltagePerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { + voltagePerPhase := make(map[model.ElectricalConnectionPhaseNameType]float64) - for _, id := range e.acVoltage { + for phase, id := range e.acVoltagePerPhase { if id != nil { voltage, err := e.getMeasurementDataForId(id) if err != nil { return nil, err } - voltagePerPhase = append(voltagePerPhase, voltage) + voltagePerPhase[phase] = voltage } } @@ -210,11 +210,11 @@ func (e *MPC) UpdateDataPowerPhaseA( ) usecaseapi.UpdateMeasurementData { return newUpdateData( "acPowerPhaseA is not supported, please check the configuration", - e.acPower[0], + e.acPowerPerPhase[model.ElectricalConnectionPhaseNameTypeA], measurementData( acPowerPhaseA, timestamp, - e.powerConfig.ValueSourcePhaseA, + e.powerConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeA], valueState, nil, nil, @@ -232,11 +232,11 @@ func (e *MPC) UpdateDataPowerPhaseB( ) usecaseapi.UpdateMeasurementData { return newUpdateData( "acPowerPhaseB is not supported, please check the configuration", - e.acPower[1], + e.acPowerPerPhase[model.ElectricalConnectionPhaseNameTypeB], measurementData( acPowerPhaseB, timestamp, - e.powerConfig.ValueSourcePhaseB, + e.powerConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeB], valueState, nil, nil, @@ -254,11 +254,11 @@ func (e *MPC) UpdateDataPowerPhaseC( ) usecaseapi.UpdateMeasurementData { return newUpdateData( "acPowerPhaseC is not supported, please check the configuration", - e.acPower[2], + e.acPowerPerPhase[model.ElectricalConnectionPhaseNameTypeC], measurementData( acPowerPhaseC, timestamp, - e.powerConfig.ValueSourcePhaseC, + e.powerConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeC], valueState, nil, nil, @@ -279,6 +279,13 @@ func (e *MPC) UpdateDataEnergyConsumed( evaluationStart *time.Time, evaluationEnd *time.Time, ) usecaseapi.UpdateMeasurementData { + if e.acEnergyConsumed == nil { + return newUpdateData( + "acEnergyConsumed is not supported, please check the configuration", + nil, + nil, + ) + } return newUpdateData( "acEnergyConsumed is not supported, please check the configuration", e.acEnergyConsumed, @@ -304,6 +311,13 @@ func (e *MPC) UpdateDataEnergyProduced( evaluationStart *time.Time, evaluationEnd *time.Time, ) usecaseapi.UpdateMeasurementData { + if e.acEnergyProduced == nil { + return newUpdateData( + "acEnergyProduced is not supported, please check the configuration", + nil, + nil, + ) + } return newUpdateData( "acEnergyProduced is not supported, please check the configuration", e.acEnergyProduced, @@ -328,13 +342,21 @@ func (e *MPC) UpdateDataCurrentPhaseA( timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.UpdateMeasurementData { + // validate first if current is supported + if e.currentConfig == nil { + return newUpdateData( + "acCurrent is not supported, please check the configuration", + nil, + nil, + ) + } return newUpdateData( "acCurrentPhaseA is not supported, please check the configuration", - e.acCurrent[0], + e.acCurrentPerPhase[model.ElectricalConnectionPhaseNameTypeA], measurementData( acCurrentPhaseA, timestamp, - e.currentConfig.ValueSourcePhaseA, + e.currentConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeA], valueState, nil, nil, @@ -350,13 +372,21 @@ func (e *MPC) UpdateDataCurrentPhaseB( timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.UpdateMeasurementData { + // validate first if current is supported + if e.currentConfig == nil { + return newUpdateData( + "acCurrent is not supported, please check the configuration", + nil, + nil, + ) + } return newUpdateData( "acCurrentPhaseB is not supported, please check the configuration", - e.acCurrent[1], + e.acCurrentPerPhase[model.ElectricalConnectionPhaseNameTypeB], measurementData( acCurrentPhaseB, timestamp, - e.currentConfig.ValueSourcePhaseB, + e.currentConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeB], valueState, nil, nil, @@ -372,13 +402,21 @@ func (e *MPC) UpdateDataCurrentPhaseC( timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.UpdateMeasurementData { + // validate first if current is supported + if e.currentConfig == nil { + return newUpdateData( + "acCurrent is not supported, please check the configuration", + nil, + nil, + ) + } return newUpdateData( "acCurrentPhaseC is not supported, please check the configuration", - e.acCurrent[2], + e.acCurrentPerPhase[model.ElectricalConnectionPhaseNameTypeC], measurementData( acCurrentPhaseC, timestamp, - e.currentConfig.ValueSourcePhaseC, + e.currentConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeC], valueState, nil, nil, @@ -396,13 +434,21 @@ func (e *MPC) UpdateDataVoltagePhaseA( timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.UpdateMeasurementData { + // validate first if voltage is supported + if e.voltageConfig == nil { + return newUpdateData( + "acVoltage is not supported, please check the configuration", + nil, + nil, + ) + } return newUpdateData( "acVoltagePhaseA is not supported, please check the configuration", - e.acVoltage[0], + e.acVoltagePerPhase[model.ElectricalConnectionPhaseNameTypeA], measurementData( voltagePhaseA, timestamp, - e.voltageConfig.ValueSourcePhaseA, + e.voltageConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeA], valueState, nil, nil, @@ -418,13 +464,21 @@ func (e *MPC) UpdateDataVoltagePhaseB( timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.UpdateMeasurementData { + // validate first if voltage is supported + if e.voltageConfig == nil { + return newUpdateData( + "acVoltage is not supported, please check the configuration", + nil, + nil, + ) + } return newUpdateData( "acVoltagePhaseB is not supported, please check the configuration", - e.acVoltage[1], + e.acVoltagePerPhase[model.ElectricalConnectionPhaseNameTypeB], measurementData( voltagePhaseB, timestamp, - e.voltageConfig.ValueSourcePhaseB, + e.voltageConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeB], valueState, nil, nil, @@ -440,13 +494,21 @@ func (e *MPC) UpdateDataVoltagePhaseC( timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.UpdateMeasurementData { + // validate first if voltage is supported + if e.voltageConfig == nil { + return newUpdateData( + "acVoltage is not supported, please check the configuration", + nil, + nil, + ) + } return newUpdateData( "acVoltagePhaseC is not supported, please check the configuration", - e.acVoltage[2], + e.acVoltagePerPhase[model.ElectricalConnectionPhaseNameTypeC], measurementData( voltagePhaseC, timestamp, - e.voltageConfig.ValueSourcePhaseC, + e.voltageConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeC], valueState, nil, nil, @@ -462,13 +524,21 @@ func (e *MPC) UpdateDataVoltagePhaseAToB( timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.UpdateMeasurementData { + // validate first if voltage is supported + if e.voltageConfig == nil { + return newUpdateData( + "acVoltage is not supported, please check the configuration", + nil, + nil, + ) + } return newUpdateData( "acVoltagePhaseAToB is not supported, please check the configuration", - e.acVoltage[3], + e.acVoltagePerPhase[model.ElectricalConnectionPhaseNameTypeAb], measurementData( voltagePhaseAToB, timestamp, - e.voltageConfig.ValueSourcePhaseAToB, + e.voltageConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeAb], valueState, nil, nil, @@ -484,13 +554,21 @@ func (e *MPC) UpdateDataVoltagePhaseBToC( timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.UpdateMeasurementData { + // validate first if voltage is supported + if e.voltageConfig == nil { + return newUpdateData( + "acVoltage is not supported, please check the configuration", + nil, + nil, + ) + } return newUpdateData( "acVoltagePhaseBToC is not supported, please check the configuration", - e.acVoltage[4], + e.acVoltagePerPhase[model.ElectricalConnectionPhaseNameTypeBc], measurementData( voltagePhaseBToC, timestamp, - e.voltageConfig.ValueSourcePhaseBToC, + e.voltageConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeBc], valueState, nil, nil, @@ -501,18 +579,26 @@ func (e *MPC) UpdateDataVoltagePhaseBToC( // use MPC.UpdateDataVoltagePhaseCToA in MPC.Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (e *MPC) UpdateDataVoltagePhaseCToA( +func (e *MPC) UpdateDataVoltagePhaseAToC( voltagePhaseCToA float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.UpdateMeasurementData { + // validate first if voltage is supported + if e.voltageConfig == nil { + return newUpdateData( + "acVoltage is not supported, please check the configuration", + nil, + nil, + ) + } return newUpdateData( "acVoltagePhaseCToA is not supported, please check the configuration", - e.acVoltage[5], + e.acVoltagePerPhase[model.ElectricalConnectionPhaseNameTypeAc], measurementData( voltagePhaseCToA, timestamp, - e.voltageConfig.ValueSourcePhaseCToA, + e.voltageConfig.ValueSourcePerPhase[model.ElectricalConnectionPhaseNameTypeAc], valueState, nil, nil, @@ -530,6 +616,14 @@ func (e *MPC) UpdateDataFrequency( timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.UpdateMeasurementData { + // Validate first if frequency is supported + if e.frequencyConfig == nil { + return newUpdateData( + "acFrequency is not supported, please check the configuration", + e.acFrequency, + nil, + ) + } return newUpdateData( "acFrequency is not supported, please check the configuration", e.acFrequency, diff --git a/usecases/mu/mpc/public_abc_test.go b/usecases/mu/mpc/public_abc_test.go index 25f7209d..14a8ed30 100644 --- a/usecases/mu/mpc/public_abc_test.go +++ b/usecases/mu/mpc/public_abc_test.go @@ -26,11 +26,13 @@ func (s *MuMpcAbcSuite) BeforeTest(suiteName, testName string) { s.MuMPCSuite = NewMuMPCSuite( &s.Suite, &MonitorPowerConfig{ - ConnectedPhases: ConnectedPhasesABC, - ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeAbc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, }, &MonitorEnergyConfig{ ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), @@ -41,18 +43,21 @@ func (s *MuMpcAbcSuite) BeforeTest(suiteName, testName string) { ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), }, &MonitorCurrentConfig{ - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, }, &MonitorVoltageConfig{ - SupportPhaseToPhase: true, - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeAb: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeBc: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeAc: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, }, &MonitorFrequencyConfig{ ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), @@ -94,10 +99,15 @@ func (s *MuMpcAbcSuite) Test_PowerPerPhase() { s.sut.UpdateDataPowerPhaseC(7.0, util.Ptr(time.Now()), util.Ptr(model.MeasurementValueStateTypeError)), ) assert.Nil(s.T(), err) + expectedPowerPerPhases := map[model.ElectricalConnectionPhaseNameType]float64{ + model.ElectricalConnectionPhaseNameTypeA: 5.0, + model.ElectricalConnectionPhaseNameTypeB: 6.0, + model.ElectricalConnectionPhaseNameTypeC: 7.0, + } powerPerPhases, err := s.sut.PowerPerPhase() assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.0, 6.0, 7.0}, powerPerPhases) + assert.Equal(s.T(), expectedPowerPerPhases, powerPerPhases) // Check if the client filter works filter := model.MeasurementDescriptionDataType{ @@ -107,7 +117,7 @@ func (s *MuMpcAbcSuite) Test_PowerPerPhase() { } values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.0, 6.0, 7.0}, values) + assert.ElementsMatch(s.T(), []float64{5.0, 6.0, 7.0}, values) } func (s *MuMpcAbcSuite) Test_EnergyConsumed() { @@ -165,10 +175,15 @@ func (s *MuMpcAbcSuite) Test_CurrentPerPhase() { s.sut.UpdateDataCurrentPhaseC(1.0, nil, nil), ) assert.Nil(s.T(), err) + expectedCurrentPerPhases := map[model.ElectricalConnectionPhaseNameType]float64{ + model.ElectricalConnectionPhaseNameTypeA: 5.0, + model.ElectricalConnectionPhaseNameTypeB: 3.0, + model.ElectricalConnectionPhaseNameTypeC: 1.0, + } currentPerPhases, err := s.sut.CurrentPerPhase() assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.0, 3.0, 1.0}, currentPerPhases) + assert.Equal(s.T(), expectedCurrentPerPhases, currentPerPhases) // Check if the client filter works filter := model.MeasurementDescriptionDataType{ @@ -178,7 +193,7 @@ func (s *MuMpcAbcSuite) Test_CurrentPerPhase() { } values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.0, 3.0, 1.0}, values) + assert.ElementsMatch(s.T(), []float64{5.0, 3.0, 1.0}, values) } func (s *MuMpcAbcSuite) Test_VoltagePerPhase() { @@ -188,13 +203,21 @@ func (s *MuMpcAbcSuite) Test_VoltagePerPhase() { s.sut.UpdateDataVoltagePhaseC(7.0, nil, nil), s.sut.UpdateDataVoltagePhaseAToB(8.0, nil, nil), s.sut.UpdateDataVoltagePhaseBToC(9.0, nil, nil), - s.sut.UpdateDataVoltagePhaseCToA(10.0, nil, nil), + s.sut.UpdateDataVoltagePhaseAToC(10.0, nil, nil), ) assert.Nil(s.T(), err) + expectedVoltagePerPhases := map[model.ElectricalConnectionPhaseNameType]float64{ + model.ElectricalConnectionPhaseNameTypeA: 5.0, + model.ElectricalConnectionPhaseNameTypeB: 6.0, + model.ElectricalConnectionPhaseNameTypeC: 7.0, + model.ElectricalConnectionPhaseNameTypeAb: 8.0, + model.ElectricalConnectionPhaseNameTypeBc: 9.0, + model.ElectricalConnectionPhaseNameTypeAc: 10.0, + } voltagePerPhases, err := s.sut.VoltagePerPhase() assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, voltagePerPhases) + assert.Equal(s.T(), expectedVoltagePerPhases, voltagePerPhases) // Check if the client filter works filter := model.MeasurementDescriptionDataType{ @@ -204,7 +227,7 @@ func (s *MuMpcAbcSuite) Test_VoltagePerPhase() { } values, err := s.measurementPhaseSpecificDataForFilter(filter, "", ucapi.PhaseNameMapping) assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, values) + assert.ElementsMatch(s.T(), []float64{5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, values) } func (s *MuMpcAbcSuite) Test_Frequency() { diff --git a/usecases/mu/mpc/public_bc_test.go b/usecases/mu/mpc/public_bc_test.go index f12646cd..7dc074ef 100644 --- a/usecases/mu/mpc/public_bc_test.go +++ b/usecases/mu/mpc/public_bc_test.go @@ -25,24 +25,29 @@ func (s *MuMpcBcSuite) BeforeTest(suiteName, testName string) { s.MuMPCSuite = NewMuMPCSuite( &s.Suite, &MonitorPowerConfig{ - ConnectedPhases: ConnectedPhasesBC, - ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeBc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, }, &MonitorEnergyConfig{ ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), }, &MonitorCurrentConfig{ - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, }, &MonitorVoltageConfig{ - SupportPhaseToPhase: true, - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeBc: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, }, &MonitorFrequencyConfig{ ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), @@ -73,10 +78,14 @@ func (s *MuMpcBcSuite) Test_PowerPerPhase() { s.sut.UpdateDataPowerPhaseC(7.0, util.Ptr(time.Now()), util.Ptr(model.MeasurementValueStateTypeError)), ) assert.Nil(s.T(), err) + expectedPowerPerPhase := map[model.ElectricalConnectionPhaseNameType]float64{ + model.ElectricalConnectionPhaseNameTypeB: 6.0, + model.ElectricalConnectionPhaseNameTypeC: 7.0, + } powerPerPhases, err := s.sut.PowerPerPhase() assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{6.0, 7.0}, powerPerPhases) + assert.Equal(s.T(), expectedPowerPerPhase, powerPerPhases) err = s.sut.Update( s.sut.UpdateDataPowerPhaseA(5.0, util.Ptr(time.Now()), nil), @@ -91,7 +100,7 @@ func (s *MuMpcBcSuite) Test_PowerPerPhase() { } values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{6.0, 7.0}, values) + assert.ElementsMatch(s.T(), []float64{6.0, 7.0}, values) } func (s *MuMpcBcSuite) Test_EnergyConsumed() { @@ -122,10 +131,14 @@ func (s *MuMpcBcSuite) Test_CurrentPerPhase() { s.sut.UpdateDataCurrentPhaseC(1.0, nil, nil), ) assert.Nil(s.T(), err) + expectedCurrentPerPhases := map[model.ElectricalConnectionPhaseNameType]float64{ + model.ElectricalConnectionPhaseNameTypeB: 3.0, + model.ElectricalConnectionPhaseNameTypeC: 1.0, + } currentPerPhases, err := s.sut.CurrentPerPhase() assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{3.0, 1.0}, currentPerPhases) + assert.Equal(s.T(), expectedCurrentPerPhases, currentPerPhases) err = s.sut.Update( s.sut.UpdateDataCurrentPhaseA(5.0, nil, nil), @@ -140,10 +153,15 @@ func (s *MuMpcBcSuite) Test_VoltagePerPhase() { s.sut.UpdateDataVoltagePhaseBToC(9.0, nil, nil), ) assert.Nil(s.T(), err) + expectedVoltagePerPhases := map[model.ElectricalConnectionPhaseNameType]float64{ + model.ElectricalConnectionPhaseNameTypeB: 6.0, + model.ElectricalConnectionPhaseNameTypeC: 7.0, + model.ElectricalConnectionPhaseNameTypeBc: 9.0, + } voltagePerPhases, err := s.sut.VoltagePerPhase() assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{6.0, 7.0, 9.0}, voltagePerPhases) + assert.Equal(s.T(), expectedVoltagePerPhases, voltagePerPhases) err = s.sut.Update( s.sut.UpdateDataVoltagePhaseA(5.0, nil, nil), @@ -156,7 +174,7 @@ func (s *MuMpcBcSuite) Test_VoltagePerPhase() { assert.NotNil(s.T(), err) err = s.sut.Update( - s.sut.UpdateDataVoltagePhaseCToA(5.0, nil, nil), + s.sut.UpdateDataVoltagePhaseAToC(5.0, nil, nil), ) assert.NotNil(s.T(), err) @@ -168,7 +186,7 @@ func (s *MuMpcBcSuite) Test_VoltagePerPhase() { } values, err := s.measurementPhaseSpecificDataForFilter(filter, "", ucapi.PhaseNameMapping) assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{6.0, 7.0, 9.0}, values) + assert.ElementsMatch(s.T(), []float64{6.0, 7.0, 9.0}, values) } func (s *MuMpcBcSuite) Test_Frequency() { diff --git a/usecases/mu/mpc/public_constraint_test.go b/usecases/mu/mpc/public_constraint_test.go index e70db4a5..16e286dd 100644 --- a/usecases/mu/mpc/public_constraint_test.go +++ b/usecases/mu/mpc/public_constraint_test.go @@ -26,17 +26,21 @@ func (s *MuMpcConstraintSuite) BeforeTest(suiteName, testName string) { s.MuMPCSuite = NewMuMPCSuite( &s.Suite, &MonitorPowerConfig{ - ConnectedPhases: ConnectedPhasesA, - ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeA, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, ValueConstraintsTotal: util.Ptr(model.MeasurementConstraintsDataType{ ValueRangeMin: model.NewScaledNumberType(0), ValueStepSize: model.NewScaledNumberType(0.1), }), - ValueConstraintsPhaseA: util.Ptr(model.MeasurementConstraintsDataType{ - ValueRangeMin: model.NewScaledNumberType(0), - ValueStepSize: model.NewScaledNumberType(0.1), - }), + ValueConstraintsPerPhase: PhaseMeasurementConstraintsMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueStepSize: model.NewScaledNumberType(0.1), + }), + }, }, &MonitorEnergyConfig{ ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), @@ -46,19 +50,26 @@ func (s *MuMpcConstraintSuite) BeforeTest(suiteName, testName string) { }), }, &MonitorCurrentConfig{ - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueConstraintsPhaseA: util.Ptr(model.MeasurementConstraintsDataType{ - ValueRangeMin: model.NewScaledNumberType(0), - ValueRangeMax: model.NewScaledNumberType(32), - ValueStepSize: model.NewScaledNumberType(0.1), - }), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + ValueConstraintsPerPhase: PhaseMeasurementConstraintsMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(32), + ValueStepSize: model.NewScaledNumberType(0.1), + }), + }, }, &MonitorVoltageConfig{ - SupportPhaseToPhase: false, - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueConstraintsPhaseA: util.Ptr(model.MeasurementConstraintsDataType{ - ValueStepSize: model.NewScaledNumberType(0.1), - }), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + ValueConstraintsPerPhase: PhaseMeasurementConstraintsMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementConstraintsDataType{ + ValueStepSize: model.NewScaledNumberType(0.1), + }), + }, }, &MonitorFrequencyConfig{ ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), @@ -73,154 +84,345 @@ func (s *MuMpcConstraintSuite) BeforeTest(suiteName, testName string) { } func (s *MuMpcConstraintSuite) Test_Power() { - err := s.sut.Update( - s.sut.UpdateDataPowerTotal(5.7, util.Ptr(time.Now()), nil), - ) - assert.Nil(s.T(), err) + // Test when getMeasurementId returns error + { + _, err := s.sut.Power() + assert.Error(s.T(), err) + } - power, err := s.sut.Power() - assert.Nil(s.T(), err) - assert.Equal(s.T(), 5.7, power) + // Testing updating the power total and read this update + { + err := s.sut.Update( + s.sut.UpdateDataPowerTotal(5.7, util.Ptr(time.Now()), nil), + ) + assert.Nil(s.T(), err) - // Check if the client filter works - filter := model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypePower), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), + power, err := s.sut.Power() + expectedPowerValue := 5.7 + assert.Nil(s.T(), err) + assert.Equal(s.T(), expectedPowerValue, power) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, nil) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.7}, values) } - values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, nil) - assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.7}, values) } func (s *MuMpcConstraintSuite) Test_PowerPerPhase() { - err := s.sut.Update( - s.sut.UpdateDataPowerPhaseA(5.7, util.Ptr(time.Now()), nil), - ) - assert.Nil(s.T(), err) + // Test when getMeasurementId returns error + { + _, err := s.sut.PowerPerPhase() + assert.Error(s.T(), err) + } + + // Test when updating power power per phase and read this update + { + err := s.sut.Update( + s.sut.UpdateDataPowerPhaseA(5.7, util.Ptr(time.Now()), nil), + ) + expectedPowerPerPhases := map[model.ElectricalConnectionPhaseNameType]float64{ + model.ElectricalConnectionPhaseNameTypeA: 5.7, + } + assert.Nil(s.T(), err) + + powerPerPhases, err := s.sut.PowerPerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), expectedPowerPerPhases, powerPerPhases) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACPower), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.7}, values) + } + + // Test updating the energy consumed when it is not supported + { + mpcInstance, err := NewMPC(s.sut.LocalEntity, s.Event, s.powerConfig, nil, s.currentConfig, s.voltageConfig, s.frequencyConfig) + assert.Nil(s.T(), err) + assert.NotNil(s.T(), mpcInstance) - powerPerPhases, err := s.sut.PowerPerPhase() - assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.7}, powerPerPhases) + err = mpcInstance.AddFeatures() + assert.Nil(s.T(), err) + mpcInstance.AddUseCase() - // Check if the client filter works - filter := model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypePower), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - ScopeType: util.Ptr(model.ScopeTypeTypeACPower), + err = mpcInstance.Update( + mpcInstance.UpdateDataEnergyConsumed(100, nil, nil, nil, nil), + ) + assert.Error(s.T(), err) } - values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) - assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{5.7}, values) } func (s *MuMpcConstraintSuite) Test_EnergyConsumed() { - err := s.sut.Update( - s.sut.UpdateDataEnergyConsumed(570, util.Ptr(time.Now()), nil, util.Ptr(time.Now()), util.Ptr(time.Now())), - ) - assert.Nil(s.T(), err) - - energyConsumed, err := s.sut.EnergyConsumed() - assert.Nil(s.T(), err) - assert.Equal(s.T(), 570.0, energyConsumed) - - // Check if the client filter works - filter := model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), - } - measurement, err := server.NewMeasurement(s.sut.LocalEntity) - assert.Nil(s.T(), err) - values, err := measurement.GetDataForFilter(filter) - assert.Nil(s.T(), err) - assert.Equal(s.T(), 1, len(values)) - assert.Equal(s.T(), 570.0, (*values[0].Value).GetValue()) + // Test when getMeasurementId returns error + { + _, err := s.sut.EnergyConsumed() + assert.Error(s.T(), err) + } + + // Test when acEnergyConsumed has no measurement id + { + mpcInstance, err := NewMPC(s.sut.LocalEntity, s.Event, s.powerConfig, s.energyConfig, s.currentConfig, s.voltageConfig, s.frequencyConfig) + assert.Nil(s.T(), err) + assert.NotNil(s.T(), mpcInstance) + + err = mpcInstance.AddFeatures() + assert.Nil(s.T(), err) + mpcInstance.AddUseCase() + + mpcInstance.acEnergyConsumed = nil + _, err = mpcInstance.EnergyConsumed() + assert.Error(s.T(), err) + } + + // Test when updating the energy consumed and get this update + { + err := s.sut.Update( + s.sut.UpdateDataEnergyConsumed(570, util.Ptr(time.Now()), nil, util.Ptr(time.Now()), util.Ptr(time.Now())), + ) + assert.Nil(s.T(), err) + + energyConsumed, err := s.sut.EnergyConsumed() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 570.0, energyConsumed) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyConsumed), + } + measurement, err := server.NewMeasurement(s.sut.LocalEntity) + assert.Nil(s.T(), err) + values, err := measurement.GetDataForFilter(filter) + assert.Nil(s.T(), err) + assert.Equal(s.T(), 1, len(values)) + assert.Equal(s.T(), 570.0, (*values[0].Value).GetValue()) + } } func (s *MuMpcConstraintSuite) Test_EnergyProduced() { - err := s.sut.Update( - s.sut.UpdateDataEnergyProduced(5.0, nil, nil, nil, nil), - ) - assert.NotNil(s.T(), err) + // Test when getMeasurementId returns error + { + _, err := s.sut.EnergyProduced() + assert.Error(s.T(), err) + } + + // Test when updating the energy produced and read this update + { + err := s.sut.Update( + s.sut.UpdateDataEnergyProduced(5.0, nil, nil, nil, nil), + ) + assert.NotNil(s.T(), err) + + _, err = s.sut.EnergyProduced() + assert.NotNil(s.T(), err) - _, err = s.sut.EnergyProduced() - assert.NotNil(s.T(), err) + // Check if the client filter works (it shouldn't) + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), + } + measurement, err := server.NewMeasurement(s.sut.LocalEntity) + assert.Nil(s.T(), err) + _, err = measurement.GetDataForFilter(filter) + assert.NotNil(s.T(), err) + } + + // Test updating the energy produced when it is not supported + { + mpcInstance, err := NewMPC(s.sut.LocalEntity, s.Event, s.powerConfig, nil, s.currentConfig, s.voltageConfig, s.frequencyConfig) + assert.Nil(s.T(), err) + assert.NotNil(s.T(), mpcInstance) - // Check if the client filter works (it shouldn't) - filter := model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - ScopeType: util.Ptr(model.ScopeTypeTypeACEnergyProduced), + err = mpcInstance.AddFeatures() + assert.Nil(s.T(), err) + mpcInstance.AddUseCase() + + err = mpcInstance.Update( + mpcInstance.UpdateDataEnergyProduced(100, nil, nil, nil, nil), + ) + assert.Error(s.T(), err) } - measurement, err := server.NewMeasurement(s.sut.LocalEntity) - assert.Nil(s.T(), err) - _, err = measurement.GetDataForFilter(filter) - assert.NotNil(s.T(), err) } func (s *MuMpcConstraintSuite) Test_CurrentPerPhase() { - err := s.sut.Update( - s.sut.UpdateDataCurrentPhaseA(0.1, nil, nil), - ) - assert.Nil(s.T(), err) + // Test when getMeasurementId returns error + { + _, err := s.sut.CurrentPerPhase() + assert.Error(s.T(), err) + } + + // Test when updating the current per phase and read this update + { + err := s.sut.Update( + s.sut.UpdateDataCurrentPhaseA(0.1, nil, nil), + ) + assert.Nil(s.T(), err) + expectedCurrentPerPhases := map[model.ElectricalConnectionPhaseNameType]float64{ + model.ElectricalConnectionPhaseNameTypeA: 0.1, + } + + currentPerPhases, err := s.sut.CurrentPerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), expectedCurrentPerPhases, currentPerPhases) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{0.1}, values) + } + + // Test updating the current per phase when it is not supported + { + mpcInstance, err := NewMPC(s.sut.LocalEntity, s.Event, s.powerConfig, s.energyConfig, nil, s.voltageConfig, s.frequencyConfig) + assert.Nil(s.T(), err) + assert.NotNil(s.T(), mpcInstance) - currentPerPhases, err := s.sut.CurrentPerPhase() - assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{0.1}, currentPerPhases) + err = mpcInstance.AddFeatures() + assert.Nil(s.T(), err) + mpcInstance.AddUseCase() - // Check if the client filter works - filter := model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + err = mpcInstance.Update( + mpcInstance.UpdateDataCurrentPhaseA(10, nil, nil), + mpcInstance.UpdateDataCurrentPhaseB(10, nil, nil), + mpcInstance.UpdateDataCurrentPhaseC(10, nil, nil), + ) + assert.Error(s.T(), err) } - values, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, ucapi.PhaseNameMapping) - assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{0.1}, values) } func (s *MuMpcConstraintSuite) Test_VoltagePerPhase() { - err := s.sut.Update( - s.sut.UpdateDataVoltagePhaseA(230, nil, nil), - ) - assert.Nil(s.T(), err) + // Test when getMeasurementId returns error + { + _, err := s.sut.VoltagePerPhase() + assert.Error(s.T(), err) + } + + // Test when updating the voltage per phase and read this update + { + err := s.sut.Update( + s.sut.UpdateDataVoltagePhaseA(230, nil, nil), + ) + assert.Nil(s.T(), err) + + expectedVoltagePerPhases := map[model.ElectricalConnectionPhaseNameType]float64{ + model.ElectricalConnectionPhaseNameTypeA: 230, + } + + voltagePerPhases, err := s.sut.VoltagePerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), expectedVoltagePerPhases, voltagePerPhases) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + } + values, err := s.measurementPhaseSpecificDataForFilter(filter, "", ucapi.PhaseNameMapping) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{230}, values) + } + + // Test updating the voltage per phase when it is not supported + { + mpcInstance, err := NewMPC(s.sut.LocalEntity, s.Event, s.powerConfig, s.energyConfig, s.currentConfig, nil, s.frequencyConfig) + assert.Nil(s.T(), err) + assert.NotNil(s.T(), mpcInstance) - voltagePerPhases, err := s.sut.VoltagePerPhase() - assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{230}, voltagePerPhases) + err = mpcInstance.AddFeatures() + assert.Nil(s.T(), err) + mpcInstance.AddUseCase() - // Check if the client filter works - filter := model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + err = mpcInstance.Update( + mpcInstance.UpdateDataVoltagePhaseA(230, nil, nil), + mpcInstance.UpdateDataVoltagePhaseB(230, nil, nil), + mpcInstance.UpdateDataVoltagePhaseC(230, nil, nil), + mpcInstance.UpdateDataVoltagePhaseAToB(0, nil, nil), + mpcInstance.UpdateDataVoltagePhaseBToC(0, nil, nil), + mpcInstance.UpdateDataVoltagePhaseAToC(0, nil, nil), + ) + assert.Error(s.T(), err) } - values, err := s.measurementPhaseSpecificDataForFilter(filter, "", ucapi.PhaseNameMapping) - assert.Nil(s.T(), err) - assert.Equal(s.T(), []float64{230}, values) } func (s *MuMpcConstraintSuite) Test_Frequency() { - err := s.sut.Update( - s.sut.UpdateDataFrequency(50, nil, nil), - ) - assert.Nil(s.T(), err) - - frequency, err := s.sut.Frequency() - assert.Nil(s.T(), err) - assert.Equal(s.T(), 50.0, frequency) - - // Check if the client filter works - filter := model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), - } - measurements, err := server.NewMeasurement(s.sut.LocalEntity) - assert.Nil(s.T(), err) - values, err := measurements.GetDataForFilter(filter) - assert.Nil(s.T(), err) - assert.Equal(s.T(), 1, len(values)) - assert.Equal(s.T(), 50.0, (*values[0].Value).GetValue()) + // Test when getMeasurementId returns error + { + _, err := s.sut.Frequency() + assert.Error(s.T(), err) + } + + // Test when acFrequency has no measurement id + { + mpcInstance, err := NewMPC(s.sut.LocalEntity, s.Event, s.powerConfig, s.energyConfig, s.currentConfig, s.voltageConfig, s.frequencyConfig) + assert.Nil(s.T(), err) + assert.NotNil(s.T(), mpcInstance) + + err = mpcInstance.AddFeatures() + assert.Nil(s.T(), err) + mpcInstance.AddUseCase() + + mpcInstance.acFrequency = nil + _, err = mpcInstance.Frequency() + assert.Error(s.T(), err) + } + + // Test when updating the frequency and read this update + { + err := s.sut.Update( + s.sut.UpdateDataFrequency(50, nil, nil), + ) + assert.Nil(s.T(), err) + + frequency, err := s.sut.Frequency() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 50.0, frequency) + + // Check if the client filter works + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), + } + measurements, err := server.NewMeasurement(s.sut.LocalEntity) + assert.Nil(s.T(), err) + values, err := measurements.GetDataForFilter(filter) + assert.Nil(s.T(), err) + assert.Equal(s.T(), 1, len(values)) + assert.Equal(s.T(), 50.0, (*values[0].Value).GetValue()) + } + + // Test covering updating frequency when it is not supported + { + mpcInstance, err := NewMPC(s.sut.LocalEntity, s.Event, s.powerConfig, s.energyConfig, s.currentConfig, s.voltageConfig, nil) + assert.Nil(s.T(), err) + assert.NotNil(s.T(), mpcInstance) + + err = mpcInstance.AddFeatures() + assert.Nil(s.T(), err) + mpcInstance.AddUseCase() + + err = mpcInstance.Update( + mpcInstance.UpdateDataFrequency(50, nil, nil), + ) + assert.Error(s.T(), err) + } } diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index 7ea62249..b4ffdca2 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -2,6 +2,7 @@ package mpc import ( "errors" + "fmt" "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" @@ -12,6 +13,8 @@ import ( "github.com/enbility/spine-go/util" ) +type PhaseMeasurementIdMap map[model.ElectricalConnectionPhaseNameType]*model.MeasurementIdType + type MPC struct { *usecase.UseCaseBase @@ -21,13 +24,13 @@ type MPC struct { voltageConfig *MonitorVoltageConfig frequencyConfig *MonitorFrequencyConfig - acPowerTotal *model.MeasurementIdType - acPower [3]*model.MeasurementIdType - acEnergyConsumed *model.MeasurementIdType - acEnergyProduced *model.MeasurementIdType - acCurrent [3]*model.MeasurementIdType - acVoltage [6]*model.MeasurementIdType // Phase to phase voltages are not supported (yet) - acFrequency *model.MeasurementIdType + acPowerTotal *model.MeasurementIdType + acPowerPerPhase PhaseMeasurementIdMap + acEnergyConsumed *model.MeasurementIdType + acEnergyProduced *model.MeasurementIdType + acCurrentPerPhase PhaseMeasurementIdMap + acVoltagePerPhase PhaseMeasurementIdMap + acFrequency *model.MeasurementIdType } // creates a new MPC usecase instance for a MonitoredUnit entity @@ -134,6 +137,9 @@ func NewMPC( voltageConfig: monitorVoltageConfig, frequencyConfig: monitorFrequencyConfig, } + uc.acPowerPerPhase = PhaseMeasurementIdMap{} + uc.acCurrentPerPhase = PhaseMeasurementIdMap{} + uc.acVoltagePerPhase = PhaseMeasurementIdMap{} _ = spine.Events.Subscribe(uc) @@ -249,48 +255,38 @@ func (e *MPC) configureMonitorPower( return errors.New("could not add parameter description") } - acPowerConstraints := []*model.MeasurementConstraintsDataType{ - e.powerConfig.ValueConstraintsPhaseA, - e.powerConfig.ValueConstraintsPhaseB, - e.powerConfig.ValueConstraintsPhaseC, - } - - acMeasuredPhases := []*model.ElectricalConnectionPhaseNameType{ - util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - } - - for id := 0; id < len(e.acPower); id++ { - if e.powerConfig.SupportsPhases(phases[id]) { - e.acPower[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypePower), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeW), - ScopeType: util.Ptr(model.ScopeTypeTypeACPower), - }) - - // if constraints are configured for acPower[id], set the - // constraint id and update measurementsConstraintData - if acPowerConstraints[id] != nil { - acPowerConstraints[id].MeasurementId = e.acPower[id] - *measurementsConstraintData = append(*measurementsConstraintData, *acPowerConstraints[id]) - } + for phase := range e.powerConfig.ValueSourcePerPhase { + if !e.powerConfig.SupportsPhases([]string{string(phase)}) { + errStr := fmt.Sprintf("power configuration for phase %s is not supported, please check the configuration", phase) + return errors.New(errStr) + } + e.acPowerPerPhase[phase] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeW), + ScopeType: util.Ptr(model.ScopeTypeTypeACPower), + }) - parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: electricalConnectionId, - MeasurementId: e.acPower[id], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: acMeasuredPhases[id], - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } + parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: e.acPowerPerPhase[phase], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(phase), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } + parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) + if parameterDescriptionId == nil { + return errors.New("could not add parameter description") + } - if electricalConnection.AddParameterDescription(parameterDescription) == nil { - return errors.New("could not add parameter description") - } + if e.powerConfig.ValueConstraintsPerPhase[phase] == nil { + continue } + e.powerConfig.ValueConstraintsPerPhase[phase].MeasurementId = e.acPowerPerPhase[phase] + *measurementsConstraintData = append(*measurementsConstraintData, *e.powerConfig.ValueConstraintsPerPhase[phase]) + } return nil @@ -374,48 +370,38 @@ func (e *MPC) configureMonitorCurrent( return nil } - acCurrentConstraints := []*model.MeasurementConstraintsDataType{ - e.currentConfig.ValueConstraintsPhaseA, - e.currentConfig.ValueConstraintsPhaseB, - e.currentConfig.ValueConstraintsPhaseC, - } - - acMeasuredPhases := []*model.ElectricalConnectionPhaseNameType{ - util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - } - - for id := 0; id < len(e.acCurrent); id++ { - if e.powerConfig.SupportsPhases(phases[id]) { - e.acCurrent[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeA), - ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), - }) + for phase := range e.currentConfig.ValueSourcePerPhase { + if !e.powerConfig.SupportsPhases([]string{string(phase)}) { + errStr := fmt.Sprintf("power configuration for phase %s is not supported, please check the configuration", phase) + return errors.New(errStr) + } + e.acCurrentPerPhase[phase] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeA), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + }) - // if constraints are configured for acCurrent[id], set the - // constraint id and update measurementsConstraintData - if acCurrentConstraints[id] != nil { - acCurrentConstraints[id].MeasurementId = e.acCurrent[id] - *measurementsConstraintData = append(*measurementsConstraintData, *acCurrentConstraints[id]) - } + parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: e.acCurrentPerPhase[phase], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(phase), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + } - parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: electricalConnectionId, - MeasurementId: e.acCurrent[id], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: acMeasuredPhases[id], - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - } + parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) + if parameterDescriptionId == nil { + return errors.New("could not add parameter description") + } - parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) - if parameterDescriptionId == nil { - return errors.New("could not add parameter description") - } + if e.currentConfig.ValueConstraintsPerPhase[phase] == nil { + continue } + e.currentConfig.ValueConstraintsPerPhase[phase].MeasurementId = e.acCurrentPerPhase[phase] + *measurementsConstraintData = append(*measurementsConstraintData, *e.currentConfig.ValueConstraintsPerPhase[phase]) + } return nil @@ -431,69 +417,57 @@ func (e *MPC) configureMonitorVoltage( return nil } - acVoltagePhasesFrom := []*model.ElectricalConnectionPhaseNameType{ - util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - } - - acVoltagePhasesTo := []*model.ElectricalConnectionPhaseNameType{ - util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - } - - acVoltageConstraints := []*model.MeasurementConstraintsDataType{ - e.voltageConfig.ValueConstraintsPhaseA, - e.voltageConfig.ValueConstraintsPhaseB, - e.voltageConfig.ValueConstraintsPhaseC, - e.voltageConfig.ValueConstraintsPhaseAToB, - e.voltageConfig.ValueConstraintsPhaseBToC, - e.voltageConfig.ValueConstraintsPhaseCToA, - } - - for id := 0; id < len(e.acVoltage); id++ { - if e.powerConfig.SupportsPhases(phases[id]) { - // skip PhaseToPhase voltages if they're not supported - if len(phases[id]) == 2 && !e.voltageConfig.SupportPhaseToPhase { - continue + for phase := range e.voltageConfig.ValueSourcePerPhase { + switch len(string(phase)) { + case 1: + if !e.powerConfig.SupportsPhases([]string{string(phase)}) { + errStr := fmt.Sprintf("power configuration for phase %s is not supported, please check the configuration", phase) + return errors.New(errStr) } - - e.acVoltage[id] = measurements.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeV), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), - }) - - // if constraints are configured for acVoltage[id], set the - // constraint id and update measurementsConstraintData - if acVoltageConstraints[id] != nil { - acVoltageConstraints[id].MeasurementId = e.acVoltage[id] - *measurementsConstraintData = append(*measurementsConstraintData, *acVoltageConstraints[id]) + case 2: + fromPhase := string(string(phase)[0]) + toPhase := string(string(phase)[1]) + if !e.powerConfig.SupportsPhases([]string{fromPhase, toPhase}) { + errStr := fmt.Sprintf("power configuration for phase %s is not supported, please check the configuration", phase) + return errors.New(errStr) } + } + e.acVoltagePerPhase[phase] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{} - parameterDescription := model.ElectricalConnectionParameterDescriptionDataType{ + switch len(string(phase)) { + case 1: + parameterDescription = model.ElectricalConnectionParameterDescriptionDataType{ ElectricalConnectionId: electricalConnectionId, - MeasurementId: e.acVoltage[id], + MeasurementId: e.acVoltagePerPhase[phase], VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: acVoltagePhasesFrom[id], - AcMeasuredInReferenceTo: acVoltagePhasesTo[id], + AcMeasuredPhases: util.Ptr(phase), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), } - - parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) - if parameterDescriptionId == nil { - return errors.New("could not add parameter description") + case 2: + fromPhase := string(string(phase)[0]) + toPhase := string(string(phase)[1]) + parameterDescription = model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: e.acVoltagePerPhase[phase], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameType(fromPhase)), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameType(toPhase)), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), } } + parameterDescriptionId := electricalConnection.AddParameterDescription(parameterDescription) + if parameterDescriptionId == nil { + return errors.New("could not add parameter description") + } } return nil @@ -554,12 +528,3 @@ func (e *MPC) getMeasurementDataForId(id *model.MeasurementIdType) (float64, err return data.Value.GetValue(), nil } - -var phases = [][]string{ - {"a"}, - {"b"}, - {"c"}, - {"a", "b"}, - {"b", "c"}, - {"c", "a"}, -} diff --git a/usecases/mu/mpc/usecase_test.go b/usecases/mu/mpc/usecase_test.go index 328d1504..85df088e 100644 --- a/usecases/mu/mpc/usecase_test.go +++ b/usecases/mu/mpc/usecase_test.go @@ -1,11 +1,13 @@ package mpc import ( - "github.com/enbility/eebus-go/features/server" - spinemocks "github.com/enbility/spine-go/mocks" + "errors" "testing" "time" + "github.com/enbility/eebus-go/features/server" + spineMocks "github.com/enbility/spine-go/mocks" + "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/mocks" "github.com/enbility/eebus-go/service" @@ -26,14 +28,27 @@ func TestBasicSuite(t *testing.T) { type MuMpcUsecaseSuite struct { suite.Suite - service api.ServiceInterface + service api.ServiceInterface + mockedService *mocks.ServiceInterface + + localEntity spineapi.EntityLocalInterface + mockedLocalEntity *spineMocks.EntityLocalInterface + mockedLocalDevice *spineMocks.DeviceLocalInterface + mockedLocalFeature *spineMocks.FeatureLocalInterface + + mockedRemoteEntity *spineMocks.EntityRemoteInterface + mockedRemoteDevice *spineMocks.DeviceRemoteInterface + mockedRemoteFeature *spineMocks.FeatureRemoteInterface + + mockedElectricalConnectionFeature *mocks.ElectricalConnectionServerInterface } func (s *MuMpcUsecaseSuite) Event(_ string, _ spineapi.DeviceRemoteInterface, _ spineapi.EntityRemoteInterface, _ api.EventType) { } func (s *MuMpcUsecaseSuite) BeforeTest(_, _ string) { - cert, _ := cert.CreateCertificate("test", "test", "DE", "test") + cert, err := cert.CreateCertificate("test", "test", "DE", "test") + assert.Nil(s.T(), err) configuration, _ := api.NewConfiguration( "test", "test", "test", "test", []shipapi.DeviceCategoryType{shipapi.DeviceCategoryTypeEnergyManagementSystem}, @@ -45,19 +60,35 @@ func (s *MuMpcUsecaseSuite) BeforeTest(_, _ string) { serviceHandler.EXPECT().ServicePairingDetailUpdate(mock.Anything, mock.Anything).Return().Maybe() s.service = service.NewService(configuration, serviceHandler) - _ = s.service.Setup() + err = s.service.Setup() + assert.Nil(s.T(), err) + + s.mockedRemoteDevice = spineMocks.NewDeviceRemoteInterface(s.T()) + s.mockedRemoteEntity = spineMocks.NewEntityRemoteInterface(s.T()) + s.mockedRemoteFeature = spineMocks.NewFeatureRemoteInterface(s.T()) + s.mockedRemoteDevice.EXPECT().FeatureByEntityTypeAndRole(mock.Anything, mock.Anything, mock.Anything).Return(s.mockedRemoteFeature).Maybe() + s.mockedRemoteDevice.EXPECT().Ski().Return(remoteSki).Maybe() + s.mockedRemoteEntity.EXPECT().Device().Return(s.mockedRemoteDevice).Maybe() + s.mockedRemoteEntity.EXPECT().EntityType().Return(mock.Anything).Maybe() + entityAddress := &model.EntityAddressType{} + s.mockedRemoteEntity.EXPECT().Address().Return(entityAddress).Maybe() + s.mockedRemoteFeature.EXPECT().DataCopy(mock.Anything).Return(mock.Anything).Maybe() + s.mockedRemoteFeature.EXPECT().Address().Return(&model.FeatureAddressType{}).Maybe() + s.mockedRemoteFeature.EXPECT().Operations().Return(nil).Maybe() } func (s *MuMpcUsecaseSuite) Test_MpcOptionalParameters() { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) // required - var monitorPowerConfig = MonitorPowerConfig{ - ConnectedPhases: ConnectedPhasesABC, - ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + var monitorPowerConfig = &MonitorPowerConfig{ + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeAbc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, } // the following 4 parameters are optional and can be nil @@ -66,18 +97,21 @@ func (s *MuMpcUsecaseSuite) Test_MpcOptionalParameters() { ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), } var monitorCurrentConfig = MonitorCurrentConfig{ - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, } var monitorVoltageConfig = MonitorVoltageConfig{ - SupportPhaseToPhase: true, - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeAb: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeBc: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeAc: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, } var monitorFrequencyConfig = MonitorFrequencyConfig{ ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), @@ -113,7 +147,7 @@ func (s *MuMpcUsecaseSuite) Test_MpcOptionalParameters() { mpc, err := NewMPC( localEntity, s.Event, - &monitorPowerConfig, + monitorPowerConfig, optEnergyConfig, optCurrentConfig, optVoltageConfig, @@ -126,6 +160,14 @@ func (s *MuMpcUsecaseSuite) Test_MpcOptionalParameters() { assert.Nil(s.T(), err) mpc.AddUseCase() } + + // test creating new mpc instance without power configuration + { + mpcInstance, err := NewMPC(s.localEntity, s.Event, nil, nil, nil, nil, nil) + expectedError := "the monitor power config for the MPC-Use-Case must not be nil" + assert.ErrorContains(s.T(), err, expectedError) + assert.Nil(s.T(), mpcInstance) + } } func (s *MuMpcUsecaseSuite) Test_MpcRequredParametersError() { @@ -148,11 +190,8 @@ func (s *MuMpcUsecaseSuite) Test_getMeasurementDataForId() { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) monitorPowerConfig := MonitorPowerConfig{ - ConnectedPhases: ConnectedPhasesABC, - ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeAbc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), } mpc, err := NewMPC( @@ -187,7 +226,7 @@ func (s *MuMpcUsecaseSuite) Test_getMeasurementDataForId() { } func (s *MuMpcAbcSuite) Test_AddFeatures_ElectricalFeatureNilError() { - localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity := spineMocks.NewEntityLocalInterface(s.T()) s.sut.LocalEntity = localEntity localEntity.EXPECT().GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer).Return(nil) @@ -196,10 +235,10 @@ func (s *MuMpcAbcSuite) Test_AddFeatures_ElectricalFeatureNilError() { } func (s *MuMpcAbcSuite) Test_AddFeatures_MeasurementFeatureNilError() { - localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity := spineMocks.NewEntityLocalInterface(s.T()) s.sut.LocalEntity = localEntity - anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) anyFeature.EXPECT().AddFunctionType(mock.Anything, mock.Anything, mock.Anything).Return() localEntity.EXPECT().GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer).Return(anyFeature) @@ -210,10 +249,10 @@ func (s *MuMpcAbcSuite) Test_AddFeatures_MeasurementFeatureNilError() { } func (s *MuMpcAbcSuite) Test_AddFeatures_NewMeasurementsError() { - localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity := spineMocks.NewEntityLocalInterface(s.T()) s.sut.LocalEntity = localEntity - anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) anyFeature.EXPECT().AddFunctionType(mock.Anything, mock.Anything, mock.Anything).Return() localEntity.EXPECT().GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer).Return(anyFeature) @@ -227,10 +266,10 @@ func (s *MuMpcAbcSuite) Test_AddFeatures_NewMeasurementsError() { } func (s *MuMpcAbcSuite) Test_AddFeatures_NewElectricalConnectionError() { - localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity := spineMocks.NewEntityLocalInterface(s.T()) s.sut.LocalEntity = localEntity - anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) anyFeature.EXPECT().AddFunctionType(mock.Anything, mock.Anything, mock.Anything).Return() localEntity.EXPECT().GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer).Return(anyFeature) @@ -245,21 +284,23 @@ func (s *MuMpcAbcSuite) Test_AddFeatures_NewElectricalConnectionError() { } func (s *MuMpcUsecaseSuite) Test_configureMonitorPower() { - localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity := spineMocks.NewEntityLocalInterface(s.T()) localEntity.EXPECT().Device().Return(nil) - anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature) monitorPowerConfig := MonitorPowerConfig{ - ConnectedPhases: ConnectedPhasesABC, - ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeAbc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, } mpc, err := NewMPC( @@ -296,14 +337,14 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorPower() { electricalConnection = mocks.NewElectricalConnectionServerInterface(s.T()) electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil) - constellationsToCheck := []*ConnectedPhases{ - util.Ptr(ConnectedPhasesA), - util.Ptr(ConnectedPhasesB), - util.Ptr(ConnectedPhasesC), + constellationsToCheck := []model.ElectricalConnectionPhaseNameType{ + model.ElectricalConnectionPhaseNameTypeA, + model.ElectricalConnectionPhaseNameTypeB, + model.ElectricalConnectionPhaseNameTypeC, } for _, phaseConstellation := range constellationsToCheck { - mpc.powerConfig.ConnectedPhases = *phaseConstellation + mpc.powerConfig.ConnectedPhases = phaseConstellation err = mpc.configureMonitorPower( measurements, @@ -317,21 +358,23 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorPower() { } func (s *MuMpcUsecaseSuite) Test_configureMonitorEnergy() { - localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity := spineMocks.NewEntityLocalInterface(s.T()) localEntity.EXPECT().Device().Return(nil) - anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature) monitorPowerConfig := MonitorPowerConfig{ - ConnectedPhases: ConnectedPhasesABC, - ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeAbc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, } monitorEnergyConfig := MonitorEnergyConfig{ @@ -383,27 +426,31 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorEnergy() { } func (s *MuMpcUsecaseSuite) Test_configureMonitorCurrent() { - localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity := spineMocks.NewEntityLocalInterface(s.T()) localEntity.EXPECT().Device().Return(nil) - anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) - anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) - anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil).Maybe() + anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() - localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature) + localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature).Maybe() monitorPowerConfig := MonitorPowerConfig{ - ConnectedPhases: ConnectedPhasesABC, - ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeAbc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, } monitorCurrentConfig := MonitorCurrentConfig{ - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, } mpc, err := NewMPC( @@ -427,16 +474,16 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorCurrent() { electricalConnectionId := model.ElectricalConnectionIdType(111) constraints := make([]model.MeasurementConstraintsDataType, 0) electricalConnection = mocks.NewElectricalConnectionServerInterface(s.T()) - electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil) + electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil).Maybe() - constellationsToCheck := []*ConnectedPhases{ - util.Ptr(ConnectedPhasesA), - util.Ptr(ConnectedPhasesB), - util.Ptr(ConnectedPhasesC), + constellationsToCheck := []model.ElectricalConnectionPhaseNameType{ + model.ElectricalConnectionPhaseNameTypeA, + model.ElectricalConnectionPhaseNameTypeB, + model.ElectricalConnectionPhaseNameTypeC, } for _, phaseConstellation := range constellationsToCheck { - mpc.powerConfig.ConnectedPhases = *phaseConstellation + mpc.powerConfig.ConnectedPhases = phaseConstellation err = mpc.configureMonitorCurrent( measurements, @@ -447,34 +494,52 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorCurrent() { assert.NotNil(s.T(), err) // could not add parameter description } + + // test when using phase to phase + monitorVoltageConfig := MonitorVoltageConfig{ + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeAb: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + } + + mpcInstance, err := NewMPC(s.localEntity, s.Event, &monitorPowerConfig, nil, nil, &monitorVoltageConfig, nil) + assert.Nil(s.T(), err) + assert.NotNil(s.T(), mpcInstance) + + err = mpcInstance.configureMonitorVoltage(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) + } func (s *MuMpcUsecaseSuite) Test_configureMonitorVoltage() { - localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity := spineMocks.NewEntityLocalInterface(s.T()) localEntity.EXPECT().Device().Return(nil) - anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) - anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) - anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil).Maybe() + anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() - localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature) + localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature).Maybe() monitorPowerConfig := MonitorPowerConfig{ - ConnectedPhases: ConnectedPhasesABC, - ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeAbc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, } monitorVoltageConfig := MonitorVoltageConfig{ - SupportPhaseToPhase: true, - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeAb: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeBc: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeAc: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, } mpc, err := NewMPC( @@ -499,16 +564,16 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorVoltage() { constraints := make([]model.MeasurementConstraintsDataType, 0) electricalConnection = mocks.NewElectricalConnectionServerInterface(s.T()) - electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil) + electricalConnection.(*mocks.ElectricalConnectionServerInterface).EXPECT().AddParameterDescription(mock.Anything).Return(nil).Maybe() - constellationsToCheck := []*ConnectedPhases{ - util.Ptr(ConnectedPhasesA), - util.Ptr(ConnectedPhasesB), - util.Ptr(ConnectedPhasesC), + constellationsToCheck := []model.ElectricalConnectionPhaseNameType{ + model.ElectricalConnectionPhaseNameTypeA, + model.ElectricalConnectionPhaseNameTypeB, + model.ElectricalConnectionPhaseNameTypeC, } for _, phaseConstellation := range constellationsToCheck { - mpc.powerConfig.ConnectedPhases = *phaseConstellation + mpc.powerConfig.ConnectedPhases = phaseConstellation err = mpc.configureMonitorVoltage( measurements, @@ -522,21 +587,23 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorVoltage() { } func (s *MuMpcUsecaseSuite) Test_configureMonitorFrequency() { - localEntity := spinemocks.NewEntityLocalInterface(s.T()) + localEntity := spineMocks.NewEntityLocalInterface(s.T()) localEntity.EXPECT().Device().Return(nil) - anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) localEntity.EXPECT().FeatureOfTypeAndRole(mock.Anything, mock.Anything).Return(anyFeature) monitorPowerConfig := MonitorPowerConfig{ - ConnectedPhases: ConnectedPhasesABC, - ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeAbc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePerPhase: PhaseMeasurementSourceMap{ + model.ElectricalConnectionPhaseNameTypeA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + model.ElectricalConnectionPhaseNameTypeC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, } monitorFrequencyConfig := MonitorFrequencyConfig{ @@ -579,3 +646,74 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorFrequency() { ) assert.NotNil(s.T(), err) // could not add parameter description } + +func (s *MuMpcUsecaseSuite) TestAddFeatures() { + // Testing function AddFeatures() and cover the paths that newMeasurement will return error in it + // Covering first path when calling newMeasurement returns nil + { + s.mockedService = mocks.NewServiceInterface(s.T()) + s.mockedService.EXPECT().AddUseCase(mock.Anything).Return(nil).Maybe() + s.mockedLocalDevice = spineMocks.NewDeviceLocalInterface(s.T()) + s.mockedService.EXPECT().LocalDevice().Return(s.mockedLocalDevice).Maybe() + s.mockedLocalEntity = spineMocks.NewEntityLocalInterface(s.T()) + s.mockedLocalDevice.EXPECT().EntityForType(mock.Anything).Return(s.mockedLocalEntity).Maybe() + s.mockedLocalFeature = spineMocks.NewFeatureLocalInterface(s.T()) + s.mockedLocalEntity.EXPECT().GetOrAddFeature(mock.Anything, mock.Anything).Return(s.mockedLocalFeature).Maybe() + s.mockedLocalEntity.EXPECT().Device().Return(s.mockedLocalDevice).Maybe() + s.mockedLocalFeature.EXPECT().AddFunctionType(mock.Anything, mock.Anything, mock.Anything).Return().Maybe() + s.mockedLocalEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeMeasurement, model.RoleTypeServer).Return(nil).Once().Maybe() + + powerConfig := &MonitorPowerConfig{ + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeAbc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + mpcInstance, err := NewMPC(s.mockedLocalEntity, s.Event, powerConfig, nil, nil, nil, nil) + + assert.Nil(s.T(), err) + assert.NotNil(s.T(), mpcInstance) + + err = mpcInstance.AddFeatures() + assert.NotNil(s.T(), err) + } + + // Test covering when calling newElectricalConnection and return error + { + s.mockedLocalEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeMeasurement, model.RoleTypeServer).Return(s.mockedLocalFeature).Maybe() + s.mockedLocalEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer).Return(nil).Once().Maybe() + + powerConfig := &MonitorPowerConfig{ + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeAbc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + mpcInstance, err := NewMPC(s.mockedLocalEntity, s.Event, powerConfig, nil, nil, nil, nil) + + assert.Nil(s.T(), err) + assert.NotNil(s.T(), mpcInstance) + + err = mpcInstance.AddFeatures() + assert.NotNil(s.T(), err) + } + + // Test covering when calling GetOrAddIdForDescription Return nil + { + err := errors.New("test") + mErr := model.ErrorType{} + s.mockedElectricalConnectionFeature = mocks.NewElectricalConnectionServerInterface(s.T()) + s.mockedElectricalConnectionFeature.EXPECT().GetOrAddIdForDescription(mock.Anything).Return(nil, err).Maybe() + s.mockedLocalEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeMeasurement, model.RoleTypeServer).Return(s.mockedLocalFeature).Maybe() + s.mockedLocalEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer).Return(s.mockedLocalFeature).Maybe() + s.mockedLocalFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(util.Ptr(mErr)).Maybe() + s.mockedLocalFeature.EXPECT().DataCopy(mock.Anything).Return(util.Ptr(model.ElectricalConnectionDescriptionListDataType{})).Maybe() + powerConfig := &MonitorPowerConfig{ + ConnectedPhases: model.ElectricalConnectionPhaseNameTypeAbc, + ValueSourceTotal: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + mpcInstance, err := NewMPC(s.mockedLocalEntity, s.Event, powerConfig, nil, nil, nil, nil) + + assert.Nil(s.T(), err) + assert.NotNil(s.T(), mpcInstance) + + err = mpcInstance.AddFeatures() + assert.NotNil(s.T(), err) + } +} From 115f2ff3b8847aac16176dca86a48f5afefb2830 Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Mon, 3 Nov 2025 17:27:04 +0100 Subject: [PATCH 31/61] go fmt --- usecases/mu/mpc/public_bc_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usecases/mu/mpc/public_bc_test.go b/usecases/mu/mpc/public_bc_test.go index 7dc074ef..6965aae7 100644 --- a/usecases/mu/mpc/public_bc_test.go +++ b/usecases/mu/mpc/public_bc_test.go @@ -154,8 +154,8 @@ func (s *MuMpcBcSuite) Test_VoltagePerPhase() { ) assert.Nil(s.T(), err) expectedVoltagePerPhases := map[model.ElectricalConnectionPhaseNameType]float64{ - model.ElectricalConnectionPhaseNameTypeB: 6.0, - model.ElectricalConnectionPhaseNameTypeC: 7.0, + model.ElectricalConnectionPhaseNameTypeB: 6.0, + model.ElectricalConnectionPhaseNameTypeC: 7.0, model.ElectricalConnectionPhaseNameTypeBc: 9.0, } From 5ef84fb6380e0aed04de9b20e5eda07515b68dca Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Thu, 30 Jan 2025 15:49:48 +0100 Subject: [PATCH 32/61] Implement Marshaler/Unmarshaler for UpdateData --- usecases/mu/mpc/update_helper.go | 38 +++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/usecases/mu/mpc/update_helper.go b/usecases/mu/mpc/update_helper.go index 279f03bc..fba4bb98 100644 --- a/usecases/mu/mpc/update_helper.go +++ b/usecases/mu/mpc/update_helper.go @@ -1,11 +1,13 @@ package mpc import ( + "encoding/json" "errors" + "time" + "github.com/enbility/eebus-go/api" "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/util" - "time" ) type UpdateData struct { @@ -14,6 +16,40 @@ type UpdateData struct { measurementData api.MeasurementDataForID } +type serUpdateData struct { + Supported bool + NotSupportedError string + MeasurementData api.MeasurementDataForID +} + +func (r *UpdateData) UnmarshalJSON(data []byte) error { + aux := serUpdateData{} + + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + + r.supported = aux.Supported + if aux.NotSupportedError != "" { + r.notSupportedError = errors.New(aux.NotSupportedError) + } + r.measurementData = aux.MeasurementData + + return nil +} + +func (r *UpdateData) MarshalJSON() ([]byte, error) { + aux := serUpdateData{ + Supported: r.supported, + MeasurementData: r.measurementData, + } + if r.notSupportedError != nil { + aux.NotSupportedError = r.notSupportedError.Error() + } + + return json.Marshal(aux) +} + func (u *UpdateData) Supported() bool { return u.supported } From ea452d8817e1f8187b88d892aa2fec40558ce5d8 Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Fri, 23 Jan 2026 10:44:50 +0100 Subject: [PATCH 33/61] Expand on comment for empty HandleEvent method --- usecases/mu/mpc/events.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usecases/mu/mpc/events.go b/usecases/mu/mpc/events.go index c05e05aa..6208ae10 100644 --- a/usecases/mu/mpc/events.go +++ b/usecases/mu/mpc/events.go @@ -6,5 +6,5 @@ import ( // handle SPINE events func (e *MPC) HandleEvent(payload spineapi.EventPayload) { - // No events supported + // No events expected as remote Monitoring Appliance has no server data, and writes are not supported by the Monitored Unit } From 427c4c81d60634587d73afaaaa7eec08255c5ab8 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Thu, 8 Aug 2024 10:23:39 +0200 Subject: [PATCH 34/61] create interface and update README.md --- usecases/README.md | 5 ++ usecases/api/gcp_mgcp.go | 142 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 usecases/api/gcp_mgcp.go diff --git a/usecases/README.md b/usecases/README.md index 88166c85..665eb4b2 100644 --- a/usecases/README.md +++ b/usecases/README.md @@ -29,6 +29,11 @@ Actors: - `lpc`: Limitation of Power Consumption - `lpp`: Limitation of Power Production +- `gcp`: Grid Connection Point + + Use Cases: + - `mgcp`: Monitoring of Grid Connection Point + - `ma`: Monitoring Appliance Use Cases: diff --git a/usecases/api/gcp_mgcp.go b/usecases/api/gcp_mgcp.go new file mode 100644 index 00000000..e80c1a30 --- /dev/null +++ b/usecases/api/gcp_mgcp.go @@ -0,0 +1,142 @@ +package api + +import ( + "github.com/enbility/eebus-go/api" +) + +// Actor: Grid Connection Point +// UseCase: Monitoring of Grid Connection Point +type GcpMGCPInterface interface { + api.UseCaseInterface + + // Scenario 1 + + // set the current power limitation factor + // + // parameters: + // - factor: the factor to set + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + SetPowerLimitationFactor(factor float64) error + + // return the current power limitation factor + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + PowerLimitationFactor() (float64, error) + + // Scenario 2 + + // set the momentary power consumption or production at the grid connection point + // + // parameters: + // - power: the power to set + // - positive values are used for consumption + // - negative values are used for production + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + SetPower(power float64) error + + // return the momentary power consumption or production at the grid connection point + // + // return values: + // - positive values are used for consumption + // - negative values are used for production + Power() (float64, error) + + // Scenario 3 + + // set the total feed in energy at the grid connection point + // + // parameters: + // - energy: the energy to set + // - negative values are used for production + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + SetEnergyFeedIn(energy float64) error + + // return the total feed in energy at the grid connection point + // + // return values: + // - negative values are used for production + EnergyFeedIn() (float64, error) + + // Scenario 4 + + // set the total consumption energy at the grid connection point + // + // parameters: + // - energy: the energy to set + // - positive values are used for consumption + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + SetEnergyConsumed(energy float64) error + + // return the total consumption energy at the grid connection point + // + // return values: + // - positive values are used for consumption + EnergyConsumed() (float64, error) + + // Scenario 5 + + // set the momentary current consumption or production at the grid connection point + // + // parameters: + // - phaseA: the current of phase A + // - phaseB: the current of phase B + // - phaseC: the current of phase C + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + SetCurrentPerPhase(phaseA, phaseB, phaseC float64) error + + // return the momentary current consumption or production at the grid connection point + // + // return values: + // - positive values are used for consumption + // - negative values are used for production + CurrentPerPhase() ([]float64, error) + + // Scenario 6 + + // set the voltage phase details at the grid connection point + // + // parameters: + // - phaseA: the voltage of phase A + // - phaseB: the voltage of phase B + // - phaseC: the voltage of phase C + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + SetVoltagePerPhase(phaseA, phaseB, phaseC float64) error + + // return the voltage phase details at the grid connection point + VoltagePerPhase() ([]float64, error) + + // Scenario 7 + + // set the frequency at the grid connection point + // + // parameters: + // - frequency: the frequency to set + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + SetFrequency(frequency float64) error + + // return frequency at the grid connection point + Frequency() (float64, error) +} From 21fc02fdd1cdd37a300f2c1dfe8057be5ae6e9bb Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Fri, 9 Aug 2024 11:08:44 +0200 Subject: [PATCH 35/61] Zwischenspeichern der Implementierung des MGCP-usecases --- usecases/gcp/mgcp/usecase.go | 257 +++++++++++++++++++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 usecases/gcp/mgcp/usecase.go diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go new file mode 100644 index 00000000..7cf2978a --- /dev/null +++ b/usecases/gcp/mgcp/usecase.go @@ -0,0 +1,257 @@ +package mgcp + +import ( + "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/features/server" + ucapi "github.com/enbility/eebus-go/usecases/api" + usecase "github.com/enbility/eebus-go/usecases/usecase" + spineapi "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/spine" + "github.com/enbility/spine-go/util" +) + +type MGCP struct { + *usecase.UseCaseBase + + idK1 *model.DeviceConfigurationKeyIdType + idM1 *model.MeasurementIdType + idM2 *model.MeasurementIdType + idM3 *model.MeasurementIdType + idM43 *model.MeasurementIdType + idM41 *model.MeasurementIdType + idM42 *model.MeasurementIdType + idM51 *model.MeasurementIdType + idM52 *model.MeasurementIdType + idM53 *model.MeasurementIdType + idM54 *model.MeasurementIdType + idM55 *model.MeasurementIdType + idM56 *model.MeasurementIdType + idM6 *model.MeasurementIdType +} + +var _ ucapi.GcpMGCPInterface = (*MGCP)(nil) + +func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback) *MGCP { + validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeGridConnectionPoint} + validEntityTypes := []model.EntityTypeType{ + model.EntityTypeTypeCEM, + model.EntityTypeTypeGridConnectionPointOfPremises, + } + useCaseScenarios := []api.UseCaseScenario{ + { + Scenario: model.UseCaseScenarioSupportType(1), + Mandatory: false, + ServerFeatures: []model.FeatureTypeType{model.FeatureTypeTypeDeviceConfiguration}, + }, + { + Scenario: model.UseCaseScenarioSupportType(2), + Mandatory: true, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeMeasurement, + model.FeatureTypeTypeElectricalConnection, + }, + }, + { + Scenario: model.UseCaseScenarioSupportType(3), + Mandatory: true, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeMeasurement, + model.FeatureTypeTypeElectricalConnection, + }, + }, + { + Scenario: model.UseCaseScenarioSupportType(4), + Mandatory: true, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeMeasurement, + model.FeatureTypeTypeElectricalConnection, + }, + }, + { + Scenario: model.UseCaseScenarioSupportType(5), + Mandatory: false, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeMeasurement, + model.FeatureTypeTypeElectricalConnection, + }, + }, + { + Scenario: model.UseCaseScenarioSupportType(6), + Mandatory: false, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeMeasurement, + model.FeatureTypeTypeElectricalConnection, + }, + }, + { + Scenario: model.UseCaseScenarioSupportType(7), + Mandatory: false, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeMeasurement, + model.FeatureTypeTypeElectricalConnection, + }, + }, + } + + usecase := usecase.NewUseCaseBase( + localEntity, + model.UseCaseActorTypeMonitoringAppliance, + model.UseCaseNameTypeMonitoringOfGridConnectionPoint, + "1.0.0", + "release", + useCaseScenarios, + eventCB, + UseCaseSupportUpdate, + validActorTypes, + validEntityTypes) + + uc := &MGCP{ + UseCaseBase: usecase, + } + + _ = spine.Events.Subscribe(uc) + + return uc +} + +func (e *MGCP) AddFeatures() { + // server features + deviceConfigurationFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceConfiguration, model.RoleTypeServer) + measurementFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) + electricalConnectionFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) + + deviceConfigurationFeature.AddFunctionType(model.FunctionTypeDeviceConfigurationKeyValueDescriptionListData, true, false) + deviceConfigurationFeature.AddFunctionType(model.FunctionTypeDeviceConfigurationKeyValueListData, true, false) + + measurementFeature.AddFunctionType(model.FunctionTypeMeasurementDescriptionListData, true, false) + measurementFeature.AddFunctionType(model.FunctionTypeMeasurementConstraintsListData, true, false) + measurementFeature.AddFunctionType(model.FunctionTypeMeasurementListData, true, false) + + electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionDescriptionListData, true, false) + electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionParameterDescriptionListData, true, false) + + configuration, err := server.NewDeviceConfiguration(e.LocalEntity) + if err != nil { + panic(err) + } + + e.idK1 = configuration.AddKeyValueDescription(model.DeviceConfigurationKeyValueDescriptionDataType{ + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypePvCurtailmentLimitFactor), + ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeScaledNumber), + Unit: util.Ptr(model.UnitOfMeasurementTypepct), + }) + if e.idK1 == nil { + panic("failed to add key description") + } + + measurement, err := server.NewMeasurement(e.LocalEntity) + if err != nil { + panic(err) + } + + e.idM1 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeW), + ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), + }) + + e.idM2 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeWh), + ScopeType: util.Ptr(model.ScopeTypeTypeGridFeedIn), + }) + + e.idM3 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeWh), + ScopeType: util.Ptr(model.ScopeTypeTypeGridConsumption), + }) + + e.idM41 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeA), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + }) + + e.idM42 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeA), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + }) + + e.idM43 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeA), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + }) + + e.idM51 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + + e.idM52 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + + e.idM53 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + + e.idM54 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + + e.idM55 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + + e.idM56 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + + e.idM6 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeHz), + ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), + }) + + electricalConnection, err := server.NewElectricalConnection(e.LocalEntity) + if err != nil { + panic(err) + } + + err = electricalConnection.AddDescription(model.ElectricalConnectionDescriptionDataType{ + PowerSupplyType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + PositiveEnergyDirection: util.Ptr(model.EnergyDirectionTypeConsume), + }) + if err != nil { + panic(err) + } + +} From 11670bf0a32bd20803607b7764fb51885c9251ec Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Sat, 10 Aug 2024 16:42:48 +0200 Subject: [PATCH 36/61] Added descriptions defined in MGCP-V1.0.0 --- usecases/gcp/mgcp/events.go | 1 + usecases/gcp/mgcp/public.go | 1 + usecases/gcp/mgcp/types.go | 1 + usecases/gcp/mgcp/usecase.go | 158 ++++++++++++++++++++++++++++++++++- 4 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 usecases/gcp/mgcp/events.go create mode 100644 usecases/gcp/mgcp/public.go create mode 100644 usecases/gcp/mgcp/types.go diff --git a/usecases/gcp/mgcp/events.go b/usecases/gcp/mgcp/events.go new file mode 100644 index 00000000..0fb914f7 --- /dev/null +++ b/usecases/gcp/mgcp/events.go @@ -0,0 +1 @@ +package mgcp diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go new file mode 100644 index 00000000..0fb914f7 --- /dev/null +++ b/usecases/gcp/mgcp/public.go @@ -0,0 +1 @@ +package mgcp diff --git a/usecases/gcp/mgcp/types.go b/usecases/gcp/mgcp/types.go new file mode 100644 index 00000000..0fb914f7 --- /dev/null +++ b/usecases/gcp/mgcp/types.go @@ -0,0 +1 @@ +package mgcp diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index 7cf2978a..e890067c 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -4,7 +4,7 @@ import ( "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" ucapi "github.com/enbility/eebus-go/usecases/api" - usecase "github.com/enbility/eebus-go/usecases/usecase" + "github.com/enbility/eebus-go/usecases/usecase" spineapi "github.com/enbility/spine-go/api" "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/spine" @@ -241,12 +241,20 @@ func (e *MGCP) AddFeatures() { ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), }) + if e.idM1 == nil || e.idM2 == nil || e.idM3 == nil || e.idM41 == nil || e.idM42 == nil || e.idM43 == nil || + e.idM51 == nil || e.idM52 == nil || e.idM53 == nil || e.idM54 == nil || e.idM55 == nil || e.idM56 == nil || e.idM6 == nil { + panic("failed to add measurement description") + + } + electricalConnection, err := server.NewElectricalConnection(e.LocalEntity) if err != nil { panic(err) } + idEc1 := model.ElectricalConnectionIdType(0) err = electricalConnection.AddDescription(model.ElectricalConnectionDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), PowerSupplyType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), PositiveEnergyDirection: util.Ptr(model.EnergyDirectionTypeConsume), }) @@ -254,4 +262,152 @@ func (e *MGCP) AddFeatures() { panic(err) } + idP1 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM1, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeAbc), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) + + idP2 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM2, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + }) + + idP3 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM3, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + }) + + idP41 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM41, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) + + idP42 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM42, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) + + idP43 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM43, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) + + idP51 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM51, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) + + idP52 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM52, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) + + idP53 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM53, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) + + idP54 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM54, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) + + idP55 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM55, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) + + idP56 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM56, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) + + idP6 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: util.Ptr(idEc1), + MeasurementId: e.idM6, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + }) + + if idP1 == nil || idP2 == nil || idP3 == nil || idP41 == nil || idP42 == nil || idP43 == nil || idP51 == nil || + idP52 == nil || idP53 == nil || idP54 == nil || idP55 == nil || idP56 == nil || idP6 == nil { + panic("failed to add electrical connection parameter description") + } + + for _, m := range []*model.MeasurementIdType{ + e.idM1, + e.idM2, + e.idM3, + e.idM41, + e.idM42, + e.idM43, + e.idM51, + e.idM52, + e.idM53, + e.idM54, + e.idM55, + e.idM56, + e.idM6, + } { + e.setMeasurementForId(m, 0.0) + } +} + +func (e *MGCP) setMeasurementForId(id *model.MeasurementIdType, value float64) { + // TODO +} + +func (e *MGCP) getMeasurementForId(id *model.MeasurementIdType) float64 { + // TODO + return 0.0 } From bd1e5b3f3e2d8194c2d7421991a232692985e99a Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Mon, 12 Aug 2024 09:15:10 +0200 Subject: [PATCH 37/61] Update mgcp --- usecases/gcp/mgcp/events.go | 161 ++++++++++++++++++++ usecases/gcp/mgcp/public.go | 288 +++++++++++++++++++++++++++++++++++ usecases/gcp/mgcp/types.go | 59 +++++++ usecases/gcp/mgcp/usecase.go | 48 +++++- 4 files changed, 549 insertions(+), 7 deletions(-) diff --git a/usecases/gcp/mgcp/events.go b/usecases/gcp/mgcp/events.go index 0fb914f7..abcf61c3 100644 --- a/usecases/gcp/mgcp/events.go +++ b/usecases/gcp/mgcp/events.go @@ -1 +1,162 @@ package mgcp + +import ( + "github.com/enbility/eebus-go/features/client" + internal "github.com/enbility/eebus-go/usecases/internal" + "github.com/enbility/ship-go/logging" + spineapi "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" +) + +// handle SPINE events +func (e *MGCP) HandleEvent(payload spineapi.EventPayload) { + // only about events from an SGMW entity or device changes for this remote device + + if !e.IsCompatibleEntityType(payload.Entity) { + return + } + + if internal.IsEntityConnected(payload) { + e.gridConnected(payload.Entity) + return + } + + if payload.EventType != spineapi.EventTypeDataChange || + payload.ChangeType != spineapi.ElementChangeUpdate { + return + } + + switch payload.Data.(type) { + case *model.DeviceConfigurationKeyValueDescriptionListDataType: + e.gridConfigurationDescriptionDataUpdate(payload.Entity) + + case *model.DeviceConfigurationKeyValueListDataType: + e.gridConfigurationDataUpdate(payload) + + case *model.MeasurementDescriptionListDataType: + e.gridMeasurementDescriptionDataUpdate(payload.Entity) + + case *model.MeasurementListDataType: + e.gridMeasurementDataUpdate(payload) + } +} + +// process required steps when a grid device is connected +func (e *MGCP) gridConnected(entity spineapi.EntityRemoteInterface) { + if deviceConfiguration, err := client.NewDeviceConfiguration(e.LocalEntity, entity); err == nil { + if _, err := deviceConfiguration.Subscribe(); err != nil { + logging.Log().Error(err) + } + + // get configuration data + if _, err := deviceConfiguration.RequestKeyValueDescriptions(nil, nil); err != nil { + logging.Log().Error(err) + } + } + + if electricalConnection, err := client.NewElectricalConnection(e.LocalEntity, entity); err == nil { + if _, err := electricalConnection.Subscribe(); err != nil { + logging.Log().Error(err) + } + + // get electrical connection parameter + if _, err := electricalConnection.RequestDescriptions(nil, nil); err != nil { + logging.Log().Error(err) + } + + if _, err := electricalConnection.RequestParameterDescriptions(nil, nil); err != nil { + logging.Log().Error(err) + } + } + + if measurement, err := client.NewMeasurement(e.LocalEntity, entity); err == nil { + if _, err := measurement.Subscribe(); err != nil { + logging.Log().Error(err) + } + + // get measurement parameters + if _, err := measurement.RequestDescriptions(nil, nil); err != nil { + logging.Log().Error(err) + } + + if _, err := measurement.RequestConstraints(nil, nil); err != nil { + logging.Log().Error(err) + } + } +} + +// the configuration key description data of an SMGW was updated +func (e *MGCP) gridConfigurationDescriptionDataUpdate(entity spineapi.EntityRemoteInterface) { + if deviceConfiguration, err := client.NewDeviceConfiguration(e.LocalEntity, entity); err == nil { + // key value descriptions received, now get the data + if _, err := deviceConfiguration.RequestKeyValues(nil, nil); err != nil { + logging.Log().Error("Error getting configuration key values:", err) + } + } +} + +// the configuration key data of an SMGW was updated +func (e *MGCP) gridConfigurationDataUpdate(payload spineapi.EventPayload) { + if dc, err := client.NewDeviceConfiguration(e.LocalEntity, payload.Entity); err == nil { + filter := model.DeviceConfigurationKeyValueDescriptionDataType{ + KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypePvCurtailmentLimitFactor), + } + if dc.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { + e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdatePowerLimitationFactor) + } + } +} + +// the measurement descriptiondata of an SMGW was updated +func (e *MGCP) gridMeasurementDescriptionDataUpdate(entity spineapi.EntityRemoteInterface) { + if measurement, err := client.NewMeasurement(e.LocalEntity, entity); err == nil { + // measurement descriptions received, now get the data + if _, err := measurement.RequestData(nil, nil); err != nil { + logging.Log().Error("Error getting measurement list values:", err) + } + } +} + +// the measurement data of an SMGW was updated +func (e *MGCP) gridMeasurementDataUpdate(payload spineapi.EventPayload) { + if measurement, err := client.NewMeasurement(e.LocalEntity, payload.Entity); err == nil { + // Scenario 2 + filter := model.MeasurementDescriptionDataType{ + ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), + } + if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { + e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdatePower) + } + + // Scenario 3 + filter.ScopeType = util.Ptr(model.ScopeTypeTypeGridFeedIn) + if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { + e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdateEnergyFeedIn) + } + + // Scenario 4 + filter.ScopeType = util.Ptr(model.ScopeTypeTypeGridConsumption) + if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { + e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdateEnergyConsumed) + } + + // Scenario 5 + filter.ScopeType = util.Ptr(model.ScopeTypeTypeACCurrent) + if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { + e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdateCurrentPerPhase) + } + + // Scenario 6 + filter.ScopeType = util.Ptr(model.ScopeTypeTypeACVoltage) + if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { + e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdateVoltagePerPhase) + } + + // Scenario 7 + filter.ScopeType = util.Ptr(model.ScopeTypeTypeACFrequency) + if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { + e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdateFrequency) + } + } +} diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go index 0fb914f7..4c64f834 100644 --- a/usecases/gcp/mgcp/public.go +++ b/usecases/gcp/mgcp/public.go @@ -1 +1,289 @@ package mgcp + +import ( + "errors" + "github.com/enbility/eebus-go/api" +) + +// Scenario 1 + +// set the current power limitation factor +// +// parameters: +// - factor: the factor to set +// +// possible errors: +// - ErrDataNotAvailable if no such limit is (yet) available +// - and others +func (m *MGCP) SetPowerLimitationFactor(factor float64) error { + return errors.New("not implemented") +} + +// return the current power limitation factor +// +// possible errors: +// - ErrDataNotAvailable if no such limit is (yet) available +// - and others +func (m *MGCP) PowerLimitationFactor() (float64, error) { + return 0, errors.New("not implemented") +} + +// Scenario 2 + +// set the momentary power consumption or production at the grid connection point +// +// parameters: +// - power: the power to set +// - positive values are used for consumption +// - negative values are used for production +// +// possible errors: +// - ErrDataNotAvailable if no such limit is (yet) available +// - and others +func (m *MGCP) SetPower(power float64) error { + if m.idM1 == nil { + return api.ErrMissingData + } + + return m.setMeasurementDataForId(m.idM1, power) +} + +// return the momentary power consumption or production at the grid connection point +// +// return values: +// - positive values are used for consumption +// - negative values are used for production +func (m *MGCP) Power() (float64, error) { + if m.idM1 == nil { + return 0, api.ErrMissingData + } + + return m.getMeasurementDataForId(m.idM1) +} + +// Scenario 3 + +// set the total feed in energy at the grid connection point +// +// parameters: +// - energy: the energy to set +// - negative values are used for production +// +// possible errors: +// - ErrDataNotAvailable if no such limit is (yet) available +// - and others +func (m *MGCP) SetEnergyFeedIn(energy float64) error { + if m.idM2 == nil { + return api.ErrMissingData + } + + return m.setMeasurementDataForId(m.idM2, energy) +} + +// return the total feed in energy at the grid connection point +// +// return values: +// - negative values are used for production +func (m *MGCP) EnergyFeedIn() (float64, error) { + if m.idM2 == nil { + return 0, api.ErrMissingData + } + + return m.getMeasurementDataForId(m.idM2) +} + +// Scenario 4 + +// set the total consumption energy at the grid connection point +// +// parameters: +// - energy: the energy to set +// - positive values are used for consumption +// +// possible errors: +// - ErrDataNotAvailable if no such limit is (yet) available +// - and others +func (m *MGCP) SetEnergyConsumed(energy float64) error { + if m.idM3 == nil { + return api.ErrMissingData + } + + return m.setMeasurementDataForId(m.idM3, energy) +} + +// return the total consumption energy at the grid connection point +// +// return values: +// - positive values are used for consumption +func (m *MGCP) EnergyConsumed() (float64, error) { + if m.idM3 == nil { + return 0, api.ErrMissingData + } + + return m.getMeasurementDataForId(m.idM3) +} + +// Scenario 5 + +// set the momentary current consumption or production at the grid connection point +// +// parameters: +// - phaseA: the current of phase A +// - phaseB: the current of phase B +// - phaseC: the current of phase C +// +// possible errors: +// - ErrDataNotAvailable if no such limit is (yet) available +// - and others +func (m *MGCP) SetCurrentPerPhase(phaseA, phaseB, phaseC float64) error { + if (m.idM41 == nil) || (m.idM42 == nil) || (m.idM43 == nil) { + return api.ErrMissingData + } + + err := m.setMeasurementDataForId(m.idM41, phaseA) + if err != nil { + return err + } + err = m.setMeasurementDataForId(m.idM42, phaseB) + if err != nil { + return err + } + err = m.setMeasurementDataForId(m.idM43, phaseC) + if err != nil { + return err + } + + return nil +} + +// return the momentary current consumption or production at the grid connection point +// +// return values: +// - positive values are used for consumption +// - negative values are used for production +func (m *MGCP) CurrentPerPhase() ([]float64, error) { + if (m.idM41 == nil) || (m.idM42 == nil) || (m.idM43 == nil) { + return []float64{}, api.ErrMissingData + } + + valueA, err := m.getMeasurementDataForId(m.idM41) + if err != nil { + return []float64{}, err + } + valueB, err := m.getMeasurementDataForId(m.idM42) + if err != nil { + return []float64{}, err + } + valueC, err := m.getMeasurementDataForId(m.idM43) + if err != nil { + return []float64{}, err + } + + return []float64{valueA, valueB, valueC}, nil +} + +// Scenario 6 + +// set the voltage phase details at the grid connection point +// +// parameters: +// - phaseA: the voltage of phase A +// - phaseB: the voltage of phase B +// - phaseC: the voltage of phase C +// +// possible errors: +// - ErrDataNotAvailable if no such limit is (yet) available +// - and others +func (m *MGCP) SetVoltagePerPhase(phaseA, phaseB, phaseC float64) error { + if (m.idM51 == nil) || (m.idM52 == nil) || (m.idM53 == nil) || (m.idM54 == nil) || (m.idM55 == nil) || (m.idM56 == nil) { + return api.ErrMissingData + } + + err := m.setMeasurementDataForId(m.idM51, phaseA) + if err != nil { + return err + } + err = m.setMeasurementDataForId(m.idM52, phaseB) + if err != nil { + return err + } + err = m.setMeasurementDataForId(m.idM53, phaseC) + if err != nil { + return err + } + err = m.setMeasurementDataForId(m.idM54, phaseA-phaseB) + if err != nil { + return err + } + err = m.setMeasurementDataForId(m.idM55, phaseB-phaseC) + if err != nil { + return err + } + err = m.setMeasurementDataForId(m.idM56, phaseC-phaseA) + if err != nil { + return err + } + + return nil +} + +// return the voltage phase details at the grid connection point +func (m *MGCP) VoltagePerPhase() ([]float64, error) { + if (m.idM51 == nil) || (m.idM52 == nil) || (m.idM53 == nil) || (m.idM54 == nil) || (m.idM55 == nil) || (m.idM56 == nil) { + return []float64{}, api.ErrMissingData + } + + valueA, err := m.getMeasurementDataForId(m.idM51) + if err != nil { + return []float64{}, err + } + valueB, err := m.getMeasurementDataForId(m.idM52) + if err != nil { + return []float64{}, err + } + valueC, err := m.getMeasurementDataForId(m.idM53) + if err != nil { + return []float64{}, err + } + valueAB, err := m.getMeasurementDataForId(m.idM54) + if err != nil { + return []float64{}, err + } + valueBC, err := m.getMeasurementDataForId(m.idM55) + if err != nil { + return []float64{}, err + } + valueCA, err := m.getMeasurementDataForId(m.idM56) + if err != nil { + return []float64{}, err + } + + return []float64{valueA, valueB, valueC, valueAB, valueBC, valueCA}, nil +} + +// Scenario 7 + +// set the frequency at the grid connection point +// +// parameters: +// - frequency: the frequency to set +// +// possible errors: +// - ErrDataNotAvailable if no such limit is (yet) available +// - and others +func (m *MGCP) SetFrequency(frequency float64) error { + if m.idM6 == nil { + return api.ErrMissingData + } + + return m.setMeasurementDataForId(m.idM6, frequency) +} + +// return frequency at the grid connection point +func (m *MGCP) Frequency() (float64, error) { + if m.idM6 == nil { + return 0, api.ErrMissingData + } + + return m.getMeasurementDataForId(m.idM6) +} diff --git a/usecases/gcp/mgcp/types.go b/usecases/gcp/mgcp/types.go index 0fb914f7..6a94de92 100644 --- a/usecases/gcp/mgcp/types.go +++ b/usecases/gcp/mgcp/types.go @@ -1 +1,60 @@ package mgcp + +import "github.com/enbility/eebus-go/api" + +const ( + // Update of the list of remote entites supporting the Use Case + // + // Use `RemoteEntities` to get the current data + UseCaseSupportUpdate api.EventType = "ma-mgcp-UseCaseSupportUpdate" + + // Grid maximum allowed feed-in power as percentage value of the cumulated + // nominal peak power of all electricity producting PV systems was updated + // + // Use `PowerLimitationFactor` to get the current data + // + // Use Case MGCP, Scenario 2 + DataUpdatePowerLimitationFactor api.EventType = "ma-mgcp-DataUpdatePowerLimitationFactor" + + // Grid momentary power consumption/production data updated + // + // Use `Power` to get the current data + // + // Use Case MGCP, Scenario 2 + DataUpdatePower api.EventType = "ma-mgcp-DataUpdatePower" + + // Total grid feed in energy data updated + // + // Use `EnergyFeedIn` to get the current data + // + // Use Case MGCP, Scenario 3 + DataUpdateEnergyFeedIn api.EventType = "ma-mgcp-DataUpdateEnergyFeedIn" + + // Total grid consumed energy data updated + // + // Use `EnergyConsumed` to get the current data + // + // Use Case MGCP, Scenario 4 + DataUpdateEnergyConsumed api.EventType = "ma-mgcp-DataUpdateEnergyConsumed" + + // Phase specific momentary current consumption/production phase detail data updated + // + // Use `CurrentPerPhase` to get the current data + // + // Use Case MGCP, Scenario 5 + DataUpdateCurrentPerPhase api.EventType = "ma-mgcp-DataUpdateCurrentPerPhase" + + // Phase specific voltage at the grid connection point + // + // Use `VoltagePerPhase` to get the current data + // + // Use Case MGCP, Scenario 6 + DataUpdateVoltagePerPhase api.EventType = "ma-mgcp-DataUpdateVoltagePerPhase" + + // Grid frequency data updated + // + // Use `Frequency` to get the current data + // + // Use Case MGCP, Scenario 7 + DataUpdateFrequency api.EventType = "ma-mgcp-DataUpdateFrequency" +) diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index e890067c..230f2b8f 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -9,6 +9,7 @@ import ( "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/spine" "github.com/enbility/spine-go/util" + "time" ) type MGCP struct { @@ -18,9 +19,9 @@ type MGCP struct { idM1 *model.MeasurementIdType idM2 *model.MeasurementIdType idM3 *model.MeasurementIdType - idM43 *model.MeasurementIdType idM41 *model.MeasurementIdType idM42 *model.MeasurementIdType + idM43 *model.MeasurementIdType idM51 *model.MeasurementIdType idM52 *model.MeasurementIdType idM53 *model.MeasurementIdType @@ -399,15 +400,48 @@ func (e *MGCP) AddFeatures() { e.idM56, e.idM6, } { - e.setMeasurementForId(m, 0.0) + err = e.setMeasurementDataForId(m, 0.0) + if err != nil { + panic(err) + } } } -func (e *MGCP) setMeasurementForId(id *model.MeasurementIdType, value float64) { - // TODO +func (e *MGCP) setMeasurementDataForId(id *model.MeasurementIdType, value float64) error { + measurements, err := server.NewMeasurement(e.LocalEntity) + if err != nil { + return err + } + + err = measurements.UpdateDataForId(model.MeasurementDataType{ + MeasurementId: id, + ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), + Timestamp: model.NewAbsoluteOrRelativeTimeTypeFromTime(time.Now()), + Value: model.NewScaledNumberType(value), + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueState: util.Ptr(model.MeasurementValueStateTypeNormal), + }, nil, *id) + if err != nil { + return err + } + + return nil } -func (e *MGCP) getMeasurementForId(id *model.MeasurementIdType) float64 { - // TODO - return 0.0 +func (e *MGCP) getMeasurementDataForId(id *model.MeasurementIdType) (float64, error) { + measurements, err := server.NewMeasurement(e.LocalEntity) + if err != nil { + return 0, err + } + + data, err := measurements.GetDataForId(*id) + if err != nil { + return 0, err + } + + if data == nil { + return 0, api.ErrDataNotAvailable + } + + return data.Value.GetValue(), nil } From f51dedd9b2a8e955da5af1e5e2988e7d8da0b767 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 14 Aug 2024 07:50:33 +0200 Subject: [PATCH 38/61] rename ids and remove getter functions --- usecases/api/gcp_mgcp.go | 39 ------- usecases/gcp/mgcp/events.go | 155 +------------------------ usecases/gcp/mgcp/public.go | 169 ++++------------------------ usecases/gcp/mgcp/types.go | 52 +-------- usecases/gcp/mgcp/usecase.go | 212 ++++++++++------------------------- 5 files changed, 85 insertions(+), 542 deletions(-) diff --git a/usecases/api/gcp_mgcp.go b/usecases/api/gcp_mgcp.go index e80c1a30..2aa09bd6 100644 --- a/usecases/api/gcp_mgcp.go +++ b/usecases/api/gcp_mgcp.go @@ -21,13 +21,6 @@ type GcpMGCPInterface interface { // - and others SetPowerLimitationFactor(factor float64) error - // return the current power limitation factor - // - // possible errors: - // - ErrDataNotAvailable if no such limit is (yet) available - // - and others - PowerLimitationFactor() (float64, error) - // Scenario 2 // set the momentary power consumption or production at the grid connection point @@ -42,13 +35,6 @@ type GcpMGCPInterface interface { // - and others SetPower(power float64) error - // return the momentary power consumption or production at the grid connection point - // - // return values: - // - positive values are used for consumption - // - negative values are used for production - Power() (float64, error) - // Scenario 3 // set the total feed in energy at the grid connection point @@ -62,12 +48,6 @@ type GcpMGCPInterface interface { // - and others SetEnergyFeedIn(energy float64) error - // return the total feed in energy at the grid connection point - // - // return values: - // - negative values are used for production - EnergyFeedIn() (float64, error) - // Scenario 4 // set the total consumption energy at the grid connection point @@ -81,12 +61,6 @@ type GcpMGCPInterface interface { // - and others SetEnergyConsumed(energy float64) error - // return the total consumption energy at the grid connection point - // - // return values: - // - positive values are used for consumption - EnergyConsumed() (float64, error) - // Scenario 5 // set the momentary current consumption or production at the grid connection point @@ -101,13 +75,6 @@ type GcpMGCPInterface interface { // - and others SetCurrentPerPhase(phaseA, phaseB, phaseC float64) error - // return the momentary current consumption or production at the grid connection point - // - // return values: - // - positive values are used for consumption - // - negative values are used for production - CurrentPerPhase() ([]float64, error) - // Scenario 6 // set the voltage phase details at the grid connection point @@ -122,9 +89,6 @@ type GcpMGCPInterface interface { // - and others SetVoltagePerPhase(phaseA, phaseB, phaseC float64) error - // return the voltage phase details at the grid connection point - VoltagePerPhase() ([]float64, error) - // Scenario 7 // set the frequency at the grid connection point @@ -136,7 +100,4 @@ type GcpMGCPInterface interface { // - ErrDataNotAvailable if no such limit is (yet) available // - and others SetFrequency(frequency float64) error - - // return frequency at the grid connection point - Frequency() (float64, error) } diff --git a/usecases/gcp/mgcp/events.go b/usecases/gcp/mgcp/events.go index abcf61c3..5886b0a9 100644 --- a/usecases/gcp/mgcp/events.go +++ b/usecases/gcp/mgcp/events.go @@ -1,162 +1,9 @@ package mgcp import ( - "github.com/enbility/eebus-go/features/client" - internal "github.com/enbility/eebus-go/usecases/internal" - "github.com/enbility/ship-go/logging" spineapi "github.com/enbility/spine-go/api" - "github.com/enbility/spine-go/model" - "github.com/enbility/spine-go/util" ) // handle SPINE events -func (e *MGCP) HandleEvent(payload spineapi.EventPayload) { - // only about events from an SGMW entity or device changes for this remote device - - if !e.IsCompatibleEntityType(payload.Entity) { - return - } - - if internal.IsEntityConnected(payload) { - e.gridConnected(payload.Entity) - return - } - - if payload.EventType != spineapi.EventTypeDataChange || - payload.ChangeType != spineapi.ElementChangeUpdate { - return - } - - switch payload.Data.(type) { - case *model.DeviceConfigurationKeyValueDescriptionListDataType: - e.gridConfigurationDescriptionDataUpdate(payload.Entity) - - case *model.DeviceConfigurationKeyValueListDataType: - e.gridConfigurationDataUpdate(payload) - - case *model.MeasurementDescriptionListDataType: - e.gridMeasurementDescriptionDataUpdate(payload.Entity) - - case *model.MeasurementListDataType: - e.gridMeasurementDataUpdate(payload) - } -} - -// process required steps when a grid device is connected -func (e *MGCP) gridConnected(entity spineapi.EntityRemoteInterface) { - if deviceConfiguration, err := client.NewDeviceConfiguration(e.LocalEntity, entity); err == nil { - if _, err := deviceConfiguration.Subscribe(); err != nil { - logging.Log().Error(err) - } - - // get configuration data - if _, err := deviceConfiguration.RequestKeyValueDescriptions(nil, nil); err != nil { - logging.Log().Error(err) - } - } - - if electricalConnection, err := client.NewElectricalConnection(e.LocalEntity, entity); err == nil { - if _, err := electricalConnection.Subscribe(); err != nil { - logging.Log().Error(err) - } - - // get electrical connection parameter - if _, err := electricalConnection.RequestDescriptions(nil, nil); err != nil { - logging.Log().Error(err) - } - - if _, err := electricalConnection.RequestParameterDescriptions(nil, nil); err != nil { - logging.Log().Error(err) - } - } - - if measurement, err := client.NewMeasurement(e.LocalEntity, entity); err == nil { - if _, err := measurement.Subscribe(); err != nil { - logging.Log().Error(err) - } - - // get measurement parameters - if _, err := measurement.RequestDescriptions(nil, nil); err != nil { - logging.Log().Error(err) - } - - if _, err := measurement.RequestConstraints(nil, nil); err != nil { - logging.Log().Error(err) - } - } -} - -// the configuration key description data of an SMGW was updated -func (e *MGCP) gridConfigurationDescriptionDataUpdate(entity spineapi.EntityRemoteInterface) { - if deviceConfiguration, err := client.NewDeviceConfiguration(e.LocalEntity, entity); err == nil { - // key value descriptions received, now get the data - if _, err := deviceConfiguration.RequestKeyValues(nil, nil); err != nil { - logging.Log().Error("Error getting configuration key values:", err) - } - } -} - -// the configuration key data of an SMGW was updated -func (e *MGCP) gridConfigurationDataUpdate(payload spineapi.EventPayload) { - if dc, err := client.NewDeviceConfiguration(e.LocalEntity, payload.Entity); err == nil { - filter := model.DeviceConfigurationKeyValueDescriptionDataType{ - KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypePvCurtailmentLimitFactor), - } - if dc.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { - e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdatePowerLimitationFactor) - } - } -} - -// the measurement descriptiondata of an SMGW was updated -func (e *MGCP) gridMeasurementDescriptionDataUpdate(entity spineapi.EntityRemoteInterface) { - if measurement, err := client.NewMeasurement(e.LocalEntity, entity); err == nil { - // measurement descriptions received, now get the data - if _, err := measurement.RequestData(nil, nil); err != nil { - logging.Log().Error("Error getting measurement list values:", err) - } - } -} - -// the measurement data of an SMGW was updated -func (e *MGCP) gridMeasurementDataUpdate(payload spineapi.EventPayload) { - if measurement, err := client.NewMeasurement(e.LocalEntity, payload.Entity); err == nil { - // Scenario 2 - filter := model.MeasurementDescriptionDataType{ - ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), - } - if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { - e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdatePower) - } - - // Scenario 3 - filter.ScopeType = util.Ptr(model.ScopeTypeTypeGridFeedIn) - if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { - e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdateEnergyFeedIn) - } - - // Scenario 4 - filter.ScopeType = util.Ptr(model.ScopeTypeTypeGridConsumption) - if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { - e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdateEnergyConsumed) - } - - // Scenario 5 - filter.ScopeType = util.Ptr(model.ScopeTypeTypeACCurrent) - if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { - e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdateCurrentPerPhase) - } - - // Scenario 6 - filter.ScopeType = util.Ptr(model.ScopeTypeTypeACVoltage) - if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { - e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdateVoltagePerPhase) - } - - // Scenario 7 - filter.ScopeType = util.Ptr(model.ScopeTypeTypeACFrequency) - if measurement.CheckEventPayloadDataForFilter(payload.Data, filter) && e.EventCB != nil { - e.EventCB(payload.Ski, payload.Device, payload.Entity, DataUpdateFrequency) - } - } +func (m *MGCP) HandleEvent(payload spineapi.EventPayload) { } diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go index 4c64f834..67345176 100644 --- a/usecases/gcp/mgcp/public.go +++ b/usecases/gcp/mgcp/public.go @@ -19,15 +19,6 @@ func (m *MGCP) SetPowerLimitationFactor(factor float64) error { return errors.New("not implemented") } -// return the current power limitation factor -// -// possible errors: -// - ErrDataNotAvailable if no such limit is (yet) available -// - and others -func (m *MGCP) PowerLimitationFactor() (float64, error) { - return 0, errors.New("not implemented") -} - // Scenario 2 // set the momentary power consumption or production at the grid connection point @@ -41,24 +32,11 @@ func (m *MGCP) PowerLimitationFactor() (float64, error) { // - ErrDataNotAvailable if no such limit is (yet) available // - and others func (m *MGCP) SetPower(power float64) error { - if m.idM1 == nil { + if m.acPowerTotal == nil { return api.ErrMissingData } - return m.setMeasurementDataForId(m.idM1, power) -} - -// return the momentary power consumption or production at the grid connection point -// -// return values: -// - positive values are used for consumption -// - negative values are used for production -func (m *MGCP) Power() (float64, error) { - if m.idM1 == nil { - return 0, api.ErrMissingData - } - - return m.getMeasurementDataForId(m.idM1) + return m.setMeasurementDataForId(m.acPowerTotal, power) } // Scenario 3 @@ -73,23 +51,11 @@ func (m *MGCP) Power() (float64, error) { // - ErrDataNotAvailable if no such limit is (yet) available // - and others func (m *MGCP) SetEnergyFeedIn(energy float64) error { - if m.idM2 == nil { + if m.gridFeedIn == nil { return api.ErrMissingData } - return m.setMeasurementDataForId(m.idM2, energy) -} - -// return the total feed in energy at the grid connection point -// -// return values: -// - negative values are used for production -func (m *MGCP) EnergyFeedIn() (float64, error) { - if m.idM2 == nil { - return 0, api.ErrMissingData - } - - return m.getMeasurementDataForId(m.idM2) + return m.setMeasurementDataForId(m.gridFeedIn, energy) } // Scenario 4 @@ -104,23 +70,10 @@ func (m *MGCP) EnergyFeedIn() (float64, error) { // - ErrDataNotAvailable if no such limit is (yet) available // - and others func (m *MGCP) SetEnergyConsumed(energy float64) error { - if m.idM3 == nil { + if m.gridConsumption == nil { return api.ErrMissingData } - - return m.setMeasurementDataForId(m.idM3, energy) -} - -// return the total consumption energy at the grid connection point -// -// return values: -// - positive values are used for consumption -func (m *MGCP) EnergyConsumed() (float64, error) { - if m.idM3 == nil { - return 0, api.ErrMissingData - } - - return m.getMeasurementDataForId(m.idM3) + return m.setMeasurementDataForId(m.gridConsumption, energy) } // Scenario 5 @@ -136,19 +89,21 @@ func (m *MGCP) EnergyConsumed() (float64, error) { // - ErrDataNotAvailable if no such limit is (yet) available // - and others func (m *MGCP) SetCurrentPerPhase(phaseA, phaseB, phaseC float64) error { - if (m.idM41 == nil) || (m.idM42 == nil) || (m.idM43 == nil) { - return api.ErrMissingData + for _, v := range m.acCurrent { + if v == nil { + return api.ErrMissingData + } } - err := m.setMeasurementDataForId(m.idM41, phaseA) + err := m.setMeasurementDataForId(m.acCurrent[0], phaseA) if err != nil { return err } - err = m.setMeasurementDataForId(m.idM42, phaseB) + err = m.setMeasurementDataForId(m.acCurrent[1], phaseB) if err != nil { return err } - err = m.setMeasurementDataForId(m.idM43, phaseC) + err = m.setMeasurementDataForId(m.acCurrent[2], phaseC) if err != nil { return err } @@ -156,32 +111,6 @@ func (m *MGCP) SetCurrentPerPhase(phaseA, phaseB, phaseC float64) error { return nil } -// return the momentary current consumption or production at the grid connection point -// -// return values: -// - positive values are used for consumption -// - negative values are used for production -func (m *MGCP) CurrentPerPhase() ([]float64, error) { - if (m.idM41 == nil) || (m.idM42 == nil) || (m.idM43 == nil) { - return []float64{}, api.ErrMissingData - } - - valueA, err := m.getMeasurementDataForId(m.idM41) - if err != nil { - return []float64{}, err - } - valueB, err := m.getMeasurementDataForId(m.idM42) - if err != nil { - return []float64{}, err - } - valueC, err := m.getMeasurementDataForId(m.idM43) - if err != nil { - return []float64{}, err - } - - return []float64{valueA, valueB, valueC}, nil -} - // Scenario 6 // set the voltage phase details at the grid connection point @@ -195,31 +124,21 @@ func (m *MGCP) CurrentPerPhase() ([]float64, error) { // - ErrDataNotAvailable if no such limit is (yet) available // - and others func (m *MGCP) SetVoltagePerPhase(phaseA, phaseB, phaseC float64) error { - if (m.idM51 == nil) || (m.idM52 == nil) || (m.idM53 == nil) || (m.idM54 == nil) || (m.idM55 == nil) || (m.idM56 == nil) { - return api.ErrMissingData + for _, v := range m.acVoltage { + if v == nil { + return api.ErrMissingData + } } - err := m.setMeasurementDataForId(m.idM51, phaseA) - if err != nil { - return err - } - err = m.setMeasurementDataForId(m.idM52, phaseB) - if err != nil { - return err - } - err = m.setMeasurementDataForId(m.idM53, phaseC) - if err != nil { - return err - } - err = m.setMeasurementDataForId(m.idM54, phaseA-phaseB) + err := m.setMeasurementDataForId(m.acVoltage[0], phaseA) if err != nil { return err } - err = m.setMeasurementDataForId(m.idM55, phaseB-phaseC) + err = m.setMeasurementDataForId(m.acVoltage[1], phaseB) if err != nil { return err } - err = m.setMeasurementDataForId(m.idM56, phaseC-phaseA) + err = m.setMeasurementDataForId(m.acVoltage[2], phaseC) if err != nil { return err } @@ -227,40 +146,6 @@ func (m *MGCP) SetVoltagePerPhase(phaseA, phaseB, phaseC float64) error { return nil } -// return the voltage phase details at the grid connection point -func (m *MGCP) VoltagePerPhase() ([]float64, error) { - if (m.idM51 == nil) || (m.idM52 == nil) || (m.idM53 == nil) || (m.idM54 == nil) || (m.idM55 == nil) || (m.idM56 == nil) { - return []float64{}, api.ErrMissingData - } - - valueA, err := m.getMeasurementDataForId(m.idM51) - if err != nil { - return []float64{}, err - } - valueB, err := m.getMeasurementDataForId(m.idM52) - if err != nil { - return []float64{}, err - } - valueC, err := m.getMeasurementDataForId(m.idM53) - if err != nil { - return []float64{}, err - } - valueAB, err := m.getMeasurementDataForId(m.idM54) - if err != nil { - return []float64{}, err - } - valueBC, err := m.getMeasurementDataForId(m.idM55) - if err != nil { - return []float64{}, err - } - valueCA, err := m.getMeasurementDataForId(m.idM56) - if err != nil { - return []float64{}, err - } - - return []float64{valueA, valueB, valueC, valueAB, valueBC, valueCA}, nil -} - // Scenario 7 // set the frequency at the grid connection point @@ -272,18 +157,8 @@ func (m *MGCP) VoltagePerPhase() ([]float64, error) { // - ErrDataNotAvailable if no such limit is (yet) available // - and others func (m *MGCP) SetFrequency(frequency float64) error { - if m.idM6 == nil { + if m.acFrequency == nil { return api.ErrMissingData } - - return m.setMeasurementDataForId(m.idM6, frequency) -} - -// return frequency at the grid connection point -func (m *MGCP) Frequency() (float64, error) { - if m.idM6 == nil { - return 0, api.ErrMissingData - } - - return m.getMeasurementDataForId(m.idM6) + return m.setMeasurementDataForId(m.acFrequency, frequency) } diff --git a/usecases/gcp/mgcp/types.go b/usecases/gcp/mgcp/types.go index 6a94de92..31a023cf 100644 --- a/usecases/gcp/mgcp/types.go +++ b/usecases/gcp/mgcp/types.go @@ -6,55 +6,5 @@ const ( // Update of the list of remote entites supporting the Use Case // // Use `RemoteEntities` to get the current data - UseCaseSupportUpdate api.EventType = "ma-mgcp-UseCaseSupportUpdate" - - // Grid maximum allowed feed-in power as percentage value of the cumulated - // nominal peak power of all electricity producting PV systems was updated - // - // Use `PowerLimitationFactor` to get the current data - // - // Use Case MGCP, Scenario 2 - DataUpdatePowerLimitationFactor api.EventType = "ma-mgcp-DataUpdatePowerLimitationFactor" - - // Grid momentary power consumption/production data updated - // - // Use `Power` to get the current data - // - // Use Case MGCP, Scenario 2 - DataUpdatePower api.EventType = "ma-mgcp-DataUpdatePower" - - // Total grid feed in energy data updated - // - // Use `EnergyFeedIn` to get the current data - // - // Use Case MGCP, Scenario 3 - DataUpdateEnergyFeedIn api.EventType = "ma-mgcp-DataUpdateEnergyFeedIn" - - // Total grid consumed energy data updated - // - // Use `EnergyConsumed` to get the current data - // - // Use Case MGCP, Scenario 4 - DataUpdateEnergyConsumed api.EventType = "ma-mgcp-DataUpdateEnergyConsumed" - - // Phase specific momentary current consumption/production phase detail data updated - // - // Use `CurrentPerPhase` to get the current data - // - // Use Case MGCP, Scenario 5 - DataUpdateCurrentPerPhase api.EventType = "ma-mgcp-DataUpdateCurrentPerPhase" - - // Phase specific voltage at the grid connection point - // - // Use `VoltagePerPhase` to get the current data - // - // Use Case MGCP, Scenario 6 - DataUpdateVoltagePerPhase api.EventType = "ma-mgcp-DataUpdateVoltagePerPhase" - - // Grid frequency data updated - // - // Use `Frequency` to get the current data - // - // Use Case MGCP, Scenario 7 - DataUpdateFrequency api.EventType = "ma-mgcp-DataUpdateFrequency" + UseCaseSupportUpdate api.EventType = "gcp-mgcp-UseCaseSupportUpdate" ) diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index 230f2b8f..47af207a 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -15,20 +15,13 @@ import ( type MGCP struct { *usecase.UseCaseBase - idK1 *model.DeviceConfigurationKeyIdType - idM1 *model.MeasurementIdType - idM2 *model.MeasurementIdType - idM3 *model.MeasurementIdType - idM41 *model.MeasurementIdType - idM42 *model.MeasurementIdType - idM43 *model.MeasurementIdType - idM51 *model.MeasurementIdType - idM52 *model.MeasurementIdType - idM53 *model.MeasurementIdType - idM54 *model.MeasurementIdType - idM55 *model.MeasurementIdType - idM56 *model.MeasurementIdType - idM6 *model.MeasurementIdType + pvLimitationFactor *model.DeviceConfigurationKeyIdType + acPowerTotal *model.MeasurementIdType + gridFeedIn *model.MeasurementIdType + gridConsumption *model.MeasurementIdType + acCurrent [3]*model.MeasurementIdType + acVoltage [3]*model.MeasurementIdType + acFrequency *model.MeasurementIdType } var _ ucapi.GcpMGCPInterface = (*MGCP)(nil) @@ -116,11 +109,11 @@ func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC return uc } -func (e *MGCP) AddFeatures() { +func (m *MGCP) AddFeatures() { // server features - deviceConfigurationFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceConfiguration, model.RoleTypeServer) - measurementFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) - electricalConnectionFeature := e.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) + deviceConfigurationFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceConfiguration, model.RoleTypeServer) + measurementFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) + electricalConnectionFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) deviceConfigurationFeature.AddFunctionType(model.FunctionTypeDeviceConfigurationKeyValueDescriptionListData, true, false) deviceConfigurationFeature.AddFunctionType(model.FunctionTypeDeviceConfigurationKeyValueListData, true, false) @@ -132,123 +125,77 @@ func (e *MGCP) AddFeatures() { electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionDescriptionListData, true, false) electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionParameterDescriptionListData, true, false) - configuration, err := server.NewDeviceConfiguration(e.LocalEntity) + configuration, err := server.NewDeviceConfiguration(m.LocalEntity) if err != nil { panic(err) } - e.idK1 = configuration.AddKeyValueDescription(model.DeviceConfigurationKeyValueDescriptionDataType{ + m.pvLimitationFactor = configuration.AddKeyValueDescription(model.DeviceConfigurationKeyValueDescriptionDataType{ KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypePvCurtailmentLimitFactor), ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeScaledNumber), Unit: util.Ptr(model.UnitOfMeasurementTypepct), }) - if e.idK1 == nil { + if m.pvLimitationFactor == nil { panic("failed to add key description") } - measurement, err := server.NewMeasurement(e.LocalEntity) + measurement, err := server.NewMeasurement(m.LocalEntity) if err != nil { panic(err) } - e.idM1 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + m.acPowerTotal = measurement.AddDescription(model.MeasurementDescriptionDataType{ MeasurementType: util.Ptr(model.MeasurementTypeTypePower), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), Unit: util.Ptr(model.UnitOfMeasurementTypeW), ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), }) - e.idM2 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + m.gridFeedIn = measurement.AddDescription(model.MeasurementDescriptionDataType{ MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), Unit: util.Ptr(model.UnitOfMeasurementTypeWh), ScopeType: util.Ptr(model.ScopeTypeTypeGridFeedIn), }) - e.idM3 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + m.gridConsumption = measurement.AddDescription(model.MeasurementDescriptionDataType{ MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), Unit: util.Ptr(model.UnitOfMeasurementTypeWh), ScopeType: util.Ptr(model.ScopeTypeTypeGridConsumption), }) - e.idM41 = measurement.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeA), - ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), - }) - - e.idM42 = measurement.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeA), - ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), - }) - - e.idM43 = measurement.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeA), - ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), - }) - - e.idM51 = measurement.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeV), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), - }) - - e.idM52 = measurement.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeV), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), - }) - - e.idM53 = measurement.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeV), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), - }) - - e.idM54 = measurement.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeV), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), - }) - - e.idM55 = measurement.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeV), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), - }) + for i := 0; i < len(m.acCurrent); i++ { + m.acCurrent[i] = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeA), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + }) + } - e.idM56 = measurement.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeV), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), - }) + for i := 0; i < len(m.acVoltage); i++ { + m.acVoltage[i] = measurement.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) + } - e.idM6 = measurement.AddDescription(model.MeasurementDescriptionDataType{ + m.acFrequency = measurement.AddDescription(model.MeasurementDescriptionDataType{ MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), Unit: util.Ptr(model.UnitOfMeasurementTypeHz), ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), }) - if e.idM1 == nil || e.idM2 == nil || e.idM3 == nil || e.idM41 == nil || e.idM42 == nil || e.idM43 == nil || - e.idM51 == nil || e.idM52 == nil || e.idM53 == nil || e.idM54 == nil || e.idM55 == nil || e.idM56 == nil || e.idM6 == nil { + if m.acPowerTotal == nil || m.gridFeedIn == nil || m.gridConsumption == nil || m.acCurrent[0] == nil || m.acCurrent[1] == nil || m.acCurrent[2] == nil || + m.acVoltage[0] == nil || m.acVoltage[1] == nil || m.acVoltage[2] == nil || m.acFrequency == nil { panic("failed to add measurement description") - } - electricalConnection, err := server.NewElectricalConnection(e.LocalEntity) + electricalConnection, err := server.NewElectricalConnection(m.LocalEntity) if err != nil { panic(err) } @@ -265,7 +212,7 @@ func (e *MGCP) AddFeatures() { idP1 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM1, + MeasurementId: m.acPowerTotal, VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeAbc), AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), @@ -275,21 +222,21 @@ func (e *MGCP) AddFeatures() { idP2 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM2, + MeasurementId: m.gridFeedIn, VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), }) idP3 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM3, + MeasurementId: m.gridConsumption, VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), }) idP41 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM41, + MeasurementId: m.acCurrent[0], VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), @@ -298,7 +245,7 @@ func (e *MGCP) AddFeatures() { idP42 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM42, + MeasurementId: m.acCurrent[1], VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), @@ -307,7 +254,7 @@ func (e *MGCP) AddFeatures() { idP43 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM43, + MeasurementId: m.acCurrent[2], VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), @@ -316,7 +263,7 @@ func (e *MGCP) AddFeatures() { idP51 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM51, + MeasurementId: m.acVoltage[0], VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), @@ -326,7 +273,7 @@ func (e *MGCP) AddFeatures() { idP52 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM52, + MeasurementId: m.acVoltage[1], VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), @@ -336,7 +283,7 @@ func (e *MGCP) AddFeatures() { idP53 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM53, + MeasurementId: m.acVoltage[2], VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), @@ -344,71 +291,34 @@ func (e *MGCP) AddFeatures() { AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), }) - idP54 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM54, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - }) - - idP55 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM55, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - }) - - idP56 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM56, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - }) - idP6 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: e.idM6, + MeasurementId: m.acFrequency, VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), }) if idP1 == nil || idP2 == nil || idP3 == nil || idP41 == nil || idP42 == nil || idP43 == nil || idP51 == nil || - idP52 == nil || idP53 == nil || idP54 == nil || idP55 == nil || idP56 == nil || idP6 == nil { + idP52 == nil || idP53 == nil || idP6 == nil { panic("failed to add electrical connection parameter description") } - for _, m := range []*model.MeasurementIdType{ - e.idM1, - e.idM2, - e.idM3, - e.idM41, - e.idM42, - e.idM43, - e.idM51, - e.idM52, - e.idM53, - e.idM54, - e.idM55, - e.idM56, - e.idM6, + for _, meas := range []*model.MeasurementIdType{ + m.acPowerTotal, + m.gridFeedIn, + m.gridConsumption, + m.acCurrent[0], m.acCurrent[1], m.acCurrent[2], + m.acVoltage[0], m.acVoltage[1], m.acVoltage[2], + m.acFrequency, } { - err = e.setMeasurementDataForId(m, 0.0) + err = m.setMeasurementDataForId(meas, 0.0) if err != nil { panic(err) } } } -func (e *MGCP) setMeasurementDataForId(id *model.MeasurementIdType, value float64) error { - measurements, err := server.NewMeasurement(e.LocalEntity) +func (m *MGCP) setMeasurementDataForId(id *model.MeasurementIdType, value float64) error { + measurements, err := server.NewMeasurement(m.LocalEntity) if err != nil { return err } @@ -428,8 +338,8 @@ func (e *MGCP) setMeasurementDataForId(id *model.MeasurementIdType, value float6 return nil } -func (e *MGCP) getMeasurementDataForId(id *model.MeasurementIdType) (float64, error) { - measurements, err := server.NewMeasurement(e.LocalEntity) +func (m *MGCP) getMeasurementDataForId(id *model.MeasurementIdType) (float64, error) { + measurements, err := server.NewMeasurement(m.LocalEntity) if err != nil { return 0, err } From c5334d3a12c5a15e1708c29af3ec2c5879861fb9 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 14 Aug 2024 08:21:18 +0200 Subject: [PATCH 39/61] implement setter SetPvFeedInLimitationFactor. --- usecases/api/gcp_mgcp.go | 2 +- usecases/gcp/mgcp/events.go | 1 + usecases/gcp/mgcp/public.go | 25 ++++++++++++++++++--- usecases/gcp/mgcp/usecase.go | 42 +++++++++++++----------------------- 4 files changed, 39 insertions(+), 31 deletions(-) diff --git a/usecases/api/gcp_mgcp.go b/usecases/api/gcp_mgcp.go index 2aa09bd6..41274048 100644 --- a/usecases/api/gcp_mgcp.go +++ b/usecases/api/gcp_mgcp.go @@ -19,7 +19,7 @@ type GcpMGCPInterface interface { // possible errors: // - ErrDataNotAvailable if no such limit is (yet) available // - and others - SetPowerLimitationFactor(factor float64) error + SetPvFeedInLimitationFactor(factor float64) error // Scenario 2 diff --git a/usecases/gcp/mgcp/events.go b/usecases/gcp/mgcp/events.go index 5886b0a9..b792131e 100644 --- a/usecases/gcp/mgcp/events.go +++ b/usecases/gcp/mgcp/events.go @@ -6,4 +6,5 @@ import ( // handle SPINE events func (m *MGCP) HandleEvent(payload spineapi.EventPayload) { + // No event handling for MGCP } diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go index 67345176..5856fd32 100644 --- a/usecases/gcp/mgcp/public.go +++ b/usecases/gcp/mgcp/public.go @@ -1,8 +1,9 @@ package mgcp import ( - "errors" "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/features/server" + "github.com/enbility/spine-go/model" ) // Scenario 1 @@ -15,8 +16,26 @@ import ( // possible errors: // - ErrDataNotAvailable if no such limit is (yet) available // - and others -func (m *MGCP) SetPowerLimitationFactor(factor float64) error { - return errors.New("not implemented") +func (m *MGCP) SetPvFeedInLimitationFactor(factor float64) error { + configuration, err := server.NewDeviceConfiguration(m.LocalEntity) + if err != nil { + panic(err) + } + + value := model.DeviceConfigurationKeyValueValueType{ + ScaledNumber: model.NewScaledNumberType(factor), + } + + data := model.DeviceConfigurationKeyValueDataType{ + KeyId: m.pvFeedInLimitationFactor, + Value: &value, + } + + return configuration.UpdateKeyValueDataForKeyId( + data, + nil, + *m.pvFeedInLimitationFactor, + ) } // Scenario 2 diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index 47af207a..9a155848 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -15,17 +15,18 @@ import ( type MGCP struct { *usecase.UseCaseBase - pvLimitationFactor *model.DeviceConfigurationKeyIdType - acPowerTotal *model.MeasurementIdType - gridFeedIn *model.MeasurementIdType - gridConsumption *model.MeasurementIdType - acCurrent [3]*model.MeasurementIdType - acVoltage [3]*model.MeasurementIdType - acFrequency *model.MeasurementIdType + pvFeedInLimitationFactor *model.DeviceConfigurationKeyIdType + acPowerTotal *model.MeasurementIdType + gridFeedIn *model.MeasurementIdType + gridConsumption *model.MeasurementIdType + acCurrent [3]*model.MeasurementIdType + acVoltage [3]*model.MeasurementIdType // Phase to phase voltages are not supported (yet) + acFrequency *model.MeasurementIdType } var _ ucapi.GcpMGCPInterface = (*MGCP)(nil) +// At the moment the MGCP use case configures itself as a 3-phase meter by default (ABC). func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback) *MGCP { validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeGridConnectionPoint} validEntityTypes := []model.EntityTypeType{ @@ -130,12 +131,12 @@ func (m *MGCP) AddFeatures() { panic(err) } - m.pvLimitationFactor = configuration.AddKeyValueDescription(model.DeviceConfigurationKeyValueDescriptionDataType{ + m.pvFeedInLimitationFactor = configuration.AddKeyValueDescription(model.DeviceConfigurationKeyValueDescriptionDataType{ KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypePvCurtailmentLimitFactor), ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeScaledNumber), Unit: util.Ptr(model.UnitOfMeasurementTypepct), }) - if m.pvLimitationFactor == nil { + if m.pvFeedInLimitationFactor == nil { panic("failed to add key description") } @@ -302,6 +303,11 @@ func (m *MGCP) AddFeatures() { panic("failed to add electrical connection parameter description") } + err = m.SetPvFeedInLimitationFactor(0.0) + if err != nil { + panic(err) + } + for _, meas := range []*model.MeasurementIdType{ m.acPowerTotal, m.gridFeedIn, @@ -337,21 +343,3 @@ func (m *MGCP) setMeasurementDataForId(id *model.MeasurementIdType, value float6 return nil } - -func (m *MGCP) getMeasurementDataForId(id *model.MeasurementIdType) (float64, error) { - measurements, err := server.NewMeasurement(m.LocalEntity) - if err != nil { - return 0, err - } - - data, err := measurements.GetDataForId(*id) - if err != nil { - return 0, err - } - - if data == nil { - return 0, api.ErrDataNotAvailable - } - - return data.Value.GetValue(), nil -} From b1ee9053302e63ea28fca6e64ad4eebc33e9de7a Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 14 Aug 2024 10:27:59 +0200 Subject: [PATCH 40/61] accept all entityTypes to connect to the gcp-mgcp --- usecases/gcp/mgcp/usecase.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index 9a155848..911b3fe6 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -29,10 +29,7 @@ var _ ucapi.GcpMGCPInterface = (*MGCP)(nil) // At the moment the MGCP use case configures itself as a 3-phase meter by default (ABC). func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback) *MGCP { validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeGridConnectionPoint} - validEntityTypes := []model.EntityTypeType{ - model.EntityTypeTypeCEM, - model.EntityTypeTypeGridConnectionPointOfPremises, - } + validEntityTypes := []model.EntityTypeType(nil) // accept all entity types useCaseScenarios := []api.UseCaseScenario{ { Scenario: model.UseCaseScenarioSupportType(1), From b4eb6be0dcf0a9e50f066bef160dbe1d22b587c0 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Thu, 29 Aug 2024 11:20:15 +0200 Subject: [PATCH 41/61] little changes --- usecases/gcp/mgcp/usecase.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index 911b3fe6..e10fca85 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -29,7 +29,7 @@ var _ ucapi.GcpMGCPInterface = (*MGCP)(nil) // At the moment the MGCP use case configures itself as a 3-phase meter by default (ABC). func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback) *MGCP { validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeGridConnectionPoint} - validEntityTypes := []model.EntityTypeType(nil) // accept all entity types + var validEntityTypes []model.EntityTypeType = nil // all entity types are valid useCaseScenarios := []api.UseCaseScenario{ { Scenario: model.UseCaseScenarioSupportType(1), @@ -88,7 +88,7 @@ func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC usecase := usecase.NewUseCaseBase( localEntity, - model.UseCaseActorTypeMonitoringAppliance, + model.UseCaseActorTypeGridConnectionPoint, model.UseCaseNameTypeMonitoringOfGridConnectionPoint, "1.0.0", "release", @@ -110,16 +110,15 @@ func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC func (m *MGCP) AddFeatures() { // server features deviceConfigurationFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceConfiguration, model.RoleTypeServer) - measurementFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) - electricalConnectionFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) - deviceConfigurationFeature.AddFunctionType(model.FunctionTypeDeviceConfigurationKeyValueDescriptionListData, true, false) deviceConfigurationFeature.AddFunctionType(model.FunctionTypeDeviceConfigurationKeyValueListData, true, false) + measurementFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) measurementFeature.AddFunctionType(model.FunctionTypeMeasurementDescriptionListData, true, false) measurementFeature.AddFunctionType(model.FunctionTypeMeasurementConstraintsListData, true, false) measurementFeature.AddFunctionType(model.FunctionTypeMeasurementListData, true, false) + electricalConnectionFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionDescriptionListData, true, false) electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionParameterDescriptionListData, true, false) From f5dc5a6151925b4ad10d523dfff7b074ced2ed9c Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Mon, 5 Aug 2024 09:10:16 +0200 Subject: [PATCH 42/61] Add additional EntityTypes to the cs-lpp and cs-lpc specified in EEBus_UC..._V1.0.0 --- usecases/cs/lpc/usecase.go | 9 +++++++-- usecases/cs/lpp/usecase.go | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/usecases/cs/lpc/usecase.go b/usecases/cs/lpc/usecase.go index c964a9e0..eaa26c0b 100644 --- a/usecases/cs/lpc/usecase.go +++ b/usecases/cs/lpc/usecase.go @@ -43,8 +43,13 @@ var _ ucapi.CsLPCInterface = (*LPC)(nil) func NewLPC(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback) *LPC { validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeEnergyGuard} validEntityTypes := []model.EntityTypeType{ - model.EntityTypeTypeGridGuard, - model.EntityTypeTypeCEM, // KEO uses this entity type for an SMGW whysoever + model.EntityTypeTypeCEM, + model.EntityTypeTypeCompressor, + model.EntityTypeTypeEVSE, + model.EntityTypeTypeHeatPumpAppliance, + model.EntityTypeTypeInverter, + model.EntityTypeTypeSmartEnergyAppliance, + model.EntityTypeTypeSubMeterElectricity, } useCaseScenarios := []api.UseCaseScenario{ { diff --git a/usecases/cs/lpp/usecase.go b/usecases/cs/lpp/usecase.go index b36a4e21..6997eca5 100644 --- a/usecases/cs/lpp/usecase.go +++ b/usecases/cs/lpp/usecase.go @@ -43,8 +43,11 @@ var _ ucapi.CsLPPInterface = (*LPP)(nil) func NewLPP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback) *LPP { validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeEnergyGuard} validEntityTypes := []model.EntityTypeType{ - model.EntityTypeTypeGridGuard, - model.EntityTypeTypeCEM, // KEO uses this entity type for an SMGW whysoever + model.EntityTypeTypeCEM, + model.EntityTypeTypeEVSE, + model.EntityTypeTypeInverter, + model.EntityTypeTypeSmartEnergyAppliance, + model.EntityTypeTypeSubMeterElectricity, } useCaseScenarios := []api.UseCaseScenario{ { From 94f562568f880fbfb908721a0c4b680a05bddac4 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Mon, 14 Oct 2024 10:18:41 +0200 Subject: [PATCH 43/61] Update the mgcp usecase to be able to update multiple values at once and independent of each other. --- usecases/api/gcp_mgcp.go | 103 ---------- usecases/gcp/mgcp/model_helper.go | 31 +++ usecases/gcp/mgcp/public.go | 308 +++++++++++++++++------------- usecases/gcp/mgcp/usecase.go | 70 ++----- 4 files changed, 232 insertions(+), 280 deletions(-) delete mode 100644 usecases/api/gcp_mgcp.go create mode 100644 usecases/gcp/mgcp/model_helper.go diff --git a/usecases/api/gcp_mgcp.go b/usecases/api/gcp_mgcp.go deleted file mode 100644 index 41274048..00000000 --- a/usecases/api/gcp_mgcp.go +++ /dev/null @@ -1,103 +0,0 @@ -package api - -import ( - "github.com/enbility/eebus-go/api" -) - -// Actor: Grid Connection Point -// UseCase: Monitoring of Grid Connection Point -type GcpMGCPInterface interface { - api.UseCaseInterface - - // Scenario 1 - - // set the current power limitation factor - // - // parameters: - // - factor: the factor to set - // - // possible errors: - // - ErrDataNotAvailable if no such limit is (yet) available - // - and others - SetPvFeedInLimitationFactor(factor float64) error - - // Scenario 2 - - // set the momentary power consumption or production at the grid connection point - // - // parameters: - // - power: the power to set - // - positive values are used for consumption - // - negative values are used for production - // - // possible errors: - // - ErrDataNotAvailable if no such limit is (yet) available - // - and others - SetPower(power float64) error - - // Scenario 3 - - // set the total feed in energy at the grid connection point - // - // parameters: - // - energy: the energy to set - // - negative values are used for production - // - // possible errors: - // - ErrDataNotAvailable if no such limit is (yet) available - // - and others - SetEnergyFeedIn(energy float64) error - - // Scenario 4 - - // set the total consumption energy at the grid connection point - // - // parameters: - // - energy: the energy to set - // - positive values are used for consumption - // - // possible errors: - // - ErrDataNotAvailable if no such limit is (yet) available - // - and others - SetEnergyConsumed(energy float64) error - - // Scenario 5 - - // set the momentary current consumption or production at the grid connection point - // - // parameters: - // - phaseA: the current of phase A - // - phaseB: the current of phase B - // - phaseC: the current of phase C - // - // possible errors: - // - ErrDataNotAvailable if no such limit is (yet) available - // - and others - SetCurrentPerPhase(phaseA, phaseB, phaseC float64) error - - // Scenario 6 - - // set the voltage phase details at the grid connection point - // - // parameters: - // - phaseA: the voltage of phase A - // - phaseB: the voltage of phase B - // - phaseC: the voltage of phase C - // - // possible errors: - // - ErrDataNotAvailable if no such limit is (yet) available - // - and others - SetVoltagePerPhase(phaseA, phaseB, phaseC float64) error - - // Scenario 7 - - // set the frequency at the grid connection point - // - // parameters: - // - frequency: the frequency to set - // - // possible errors: - // - ErrDataNotAvailable if no such limit is (yet) available - // - and others - SetFrequency(frequency float64) error -} diff --git a/usecases/gcp/mgcp/model_helper.go b/usecases/gcp/mgcp/model_helper.go new file mode 100644 index 00000000..f8148759 --- /dev/null +++ b/usecases/gcp/mgcp/model_helper.go @@ -0,0 +1,31 @@ +package mgcp + +import ( + "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" + "time" +) + +type SupportedUpdateValueType int + +const ( + SupportedUpdateValueTypeMeasurement SupportedUpdateValueType = 0 + SupportedUpdateValueTypeConfiguration SupportedUpdateValueType = 1 +) + +type UpdateValueType struct { + updateValueType SupportedUpdateValueType + updateTypeMeasurement api.MeasurementDataForID + updateTypeConfiguration model.DeviceConfigurationKeyValueDataType +} + +func measuredValue(value float64) model.MeasurementDataType { + return model.MeasurementDataType{ + ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), + Timestamp: model.NewAbsoluteOrRelativeTimeTypeFromTime(time.Now()), + Value: model.NewScaledNumberType(value), + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueState: util.Ptr(model.MeasurementValueStateTypeNormal), + } +} diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go index 5856fd32..d8dda29e 100644 --- a/usecases/gcp/mgcp/public.go +++ b/usecases/gcp/mgcp/public.go @@ -6,178 +6,230 @@ import ( "github.com/enbility/spine-go/model" ) -// Scenario 1 +// -------- Getters -------- // -// set the current power limitation factor -// -// parameters: -// - factor: the factor to set -// -// possible errors: -// - ErrDataNotAvailable if no such limit is (yet) available -// - and others -func (m *MGCP) SetPvFeedInLimitationFactor(factor float64) error { - configuration, err := server.NewDeviceConfiguration(m.LocalEntity) - if err != nil { - panic(err) - } +// -------- Setters -------- // - value := model.DeviceConfigurationKeyValueValueType{ - ScaledNumber: model.NewScaledNumberType(factor), - } +// Scenario 1 - data := model.DeviceConfigurationKeyValueDataType{ - KeyId: m.pvFeedInLimitationFactor, - Value: &value, +// Use MGCP.ConfigurationPvFeedInLimitationFactor in MGCP.Update to set the current power limitation factor +func (m *MGCP) ConfigurationPvFeedInLimitationFactor(pvFeedInLimitationFactor float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeConfiguration, + updateTypeConfiguration: model.DeviceConfigurationKeyValueDataType{ + KeyId: m.pvFeedInLimitationFactor, + Value: &model.DeviceConfigurationKeyValueValueType{ + ScaledNumber: model.NewScaledNumberType(pvFeedInLimitationFactor), + }, + }, } - - return configuration.UpdateKeyValueDataForKeyId( - data, - nil, - *m.pvFeedInLimitationFactor, - ) } // Scenario 2 -// set the momentary power consumption or production at the grid connection point -// -// parameters: -// - power: the power to set -// - positive values are used for consumption -// - negative values are used for production -// -// possible errors: -// - ErrDataNotAvailable if no such limit is (yet) available -// - and others -func (m *MGCP) SetPower(power float64) error { - if m.acPowerTotal == nil { - return api.ErrMissingData +// Use MGCP.MeasurementAcPowerTotal in MGCP.Update to set the current total power +func (m *MGCP) MeasurementAcPowerTotal(acPowerTotal float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(acPowerTotal), + Id: *m.acPowerTotal, + }, } - - return m.setMeasurementDataForId(m.acPowerTotal, power) } // Scenario 3 -// set the total feed in energy at the grid connection point -// -// parameters: -// - energy: the energy to set -// - negative values are used for production -// -// possible errors: -// - ErrDataNotAvailable if no such limit is (yet) available -// - and others -func (m *MGCP) SetEnergyFeedIn(energy float64) error { - if m.gridFeedIn == nil { - return api.ErrMissingData +// Use MGCP.MeasurementAcEnergyFeedIn in MGCP.Update to set the total feed in energy +func (m *MGCP) MeasurementAcEnergyFeedIn(energy float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(energy), + Id: *m.gridFeedIn, + }, } - - return m.setMeasurementDataForId(m.gridFeedIn, energy) } // Scenario 4 -// set the total consumption energy at the grid connection point -// -// parameters: -// - energy: the energy to set -// - positive values are used for consumption -// -// possible errors: -// - ErrDataNotAvailable if no such limit is (yet) available -// - and others -func (m *MGCP) SetEnergyConsumed(energy float64) error { - if m.gridConsumption == nil { - return api.ErrMissingData +// Use MGCP.MeasurementAcEnergyConsumed in MGCP.Update to set the total feed in energy +func (m *MGCP) MeasurementAcEnergyConsumed(energy float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(energy), + Id: *m.gridConsumption, + }, } - return m.setMeasurementDataForId(m.gridConsumption, energy) } // Scenario 5 -// set the momentary current consumption or production at the grid connection point -// -// parameters: -// - phaseA: the current of phase A -// - phaseB: the current of phase B -// - phaseC: the current of phase C -// -// possible errors: -// - ErrDataNotAvailable if no such limit is (yet) available -// - and others -func (m *MGCP) SetCurrentPerPhase(phaseA, phaseB, phaseC float64) error { - for _, v := range m.acCurrent { - if v == nil { - return api.ErrMissingData - } +// Use MGCP.MeasurementAcCurrentPhaseA in MGCP.Update to set the current of phase A +func (m *MGCP) MeasurementAcCurrentPhaseA(current float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(current), + Id: *m.acCurrent[0], + }, } +} - err := m.setMeasurementDataForId(m.acCurrent[0], phaseA) - if err != nil { - return err - } - err = m.setMeasurementDataForId(m.acCurrent[1], phaseB) - if err != nil { - return err - } - err = m.setMeasurementDataForId(m.acCurrent[2], phaseC) - if err != nil { - return err +// Use MGCP.MeasurementAcCurrentPhaseB in MGCP.Update to set the current of phase B +func (m *MGCP) MeasurementAcCurrentPhaseB(current float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(current), + Id: *m.acCurrent[1], + }, } +} - return nil +// Use MGCP.MeasurementAcCurrentPhaseC in MGCP.Update to set the current of phase C +func (m *MGCP) MeasurementAcCurrentPhaseC(current float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(current), + Id: *m.acCurrent[2], + }, + } } // Scenario 6 -// set the voltage phase details at the grid connection point -// -// parameters: -// - phaseA: the voltage of phase A -// - phaseB: the voltage of phase B -// - phaseC: the voltage of phase C -// -// possible errors: -// - ErrDataNotAvailable if no such limit is (yet) available -// - and others -func (m *MGCP) SetVoltagePerPhase(phaseA, phaseB, phaseC float64) error { - for _, v := range m.acVoltage { - if v == nil { - return api.ErrMissingData - } +// Use MGCP.MeasurementAcVoltagePhaseA in MGCP.Update to set the voltage of phase A +func (m *MGCP) MeasurementAcVoltagePhaseA(voltage float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(voltage), + Id: *m.acVoltage[0], + }, + } +} + +// Use MGCP.MeasurementAcVoltagePhaseB in MGCP.Update to set the voltage of phase B +func (m *MGCP) MeasurementAcVoltagePhaseB(voltage float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(voltage), + Id: *m.acVoltage[1], + }, } +} - err := m.setMeasurementDataForId(m.acVoltage[0], phaseA) - if err != nil { - return err +// Use MGCP.MeasurementAcVoltagePhaseC in MGCP.Update to set the voltage of phase C +func (m *MGCP) MeasurementAcVoltagePhaseC(voltage float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(voltage), + Id: *m.acVoltage[2], + }, } - err = m.setMeasurementDataForId(m.acVoltage[1], phaseB) - if err != nil { - return err +} + +// Use MGCP.MeasurementAcVoltagePhaseAToB in MGCP.Update to set the voltage between phase A and B +func (m *MGCP) MeasurementAcVoltagePhaseAToB(voltage float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(voltage), + Id: *m.acVoltage[3], + }, } - err = m.setMeasurementDataForId(m.acVoltage[2], phaseC) - if err != nil { - return err +} + +// Use MGCP.MeasurementAcVoltagePhaseBToC in MGCP.Update to set the voltage between phase B and C +func (m *MGCP) MeasurementAcVoltagePhaseBToC(voltage float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(voltage), + Id: *m.acVoltage[4], + }, } +} - return nil +// Use MGCP.MeasurementAcVoltagePhaseCToA in MGCP.Update to set the voltage between phase C and A +func (m *MGCP) MeasurementAcVoltagePhaseCToA(voltage float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(voltage), + Id: *m.acVoltage[5], + }, + } } // Scenario 7 -// set the frequency at the grid connection point +// Use MGCP.MeasurementAcFrequency in MGCP.Update to set the frequency +func (m *MGCP) MeasurementAcFrequency(frequency float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Data: measuredValue(frequency), + Id: *m.acFrequency, + }, + } +} + +// Update the data + +// use MPC.Update to update the data of the MGCP Usecase +// use it like this: // -// parameters: -// - frequency: the frequency to set +// mgcp.Update( +// mgcp.MeasuredAcPowerTotal(1000), +// mgcp.MeasuredAcPowerPhaseA(500), +// ... +// ) // // possible errors: -// - ErrDataNotAvailable if no such limit is (yet) available +// - ErrMissingData if the id is not available // - and others -func (m *MGCP) SetFrequency(frequency float64) error { - if m.acFrequency == nil { - return api.ErrMissingData +func (m *MGCP) Update(updateValueType ...UpdateValueType) []error { + measurements := make([]api.MeasurementDataForID, 0) + configurations := make([]model.DeviceConfigurationKeyValueDataType, 0) + errors := make([]error, 0) + + for _, update := range updateValueType { + if update.updateValueType == SupportedUpdateValueTypeMeasurement { + measurements = append(measurements, update.updateTypeMeasurement) + } else { + configurations = append(configurations, update.updateTypeConfiguration) + } + } + + if len(measurements) > 0 { + _measurements, err := server.NewMeasurement(m.LocalEntity) + if err != nil { + errors = append(errors, err) + } + + err = _measurements.UpdateDataForIds(measurements) + if err != nil { + errors = append(errors, err) + } + } + + if len(configurations) == 1 { + _configurations, err := server.NewDeviceConfiguration(m.LocalEntity) + if err != nil { + errors = append(errors, err) + } + + err = _configurations.UpdateKeyValueDataForKeyId(configurations[0], nil, *configurations[0].KeyId) + if err != nil { + errors = append(errors, err) + } } - return m.setMeasurementDataForId(m.acFrequency, frequency) + + return errors } diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index e10fca85..82bcd190 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -3,13 +3,11 @@ package mgcp import ( "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" - ucapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/eebus-go/usecases/usecase" spineapi "github.com/enbility/spine-go/api" "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/spine" "github.com/enbility/spine-go/util" - "time" ) type MGCP struct { @@ -20,16 +18,13 @@ type MGCP struct { gridFeedIn *model.MeasurementIdType gridConsumption *model.MeasurementIdType acCurrent [3]*model.MeasurementIdType - acVoltage [3]*model.MeasurementIdType // Phase to phase voltages are not supported (yet) + acVoltage [6]*model.MeasurementIdType acFrequency *model.MeasurementIdType } -var _ ucapi.GcpMGCPInterface = (*MGCP)(nil) - // At the moment the MGCP use case configures itself as a 3-phase meter by default (ABC). func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback) *MGCP { validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeGridConnectionPoint} - var validEntityTypes []model.EntityTypeType = nil // all entity types are valid useCaseScenarios := []api.UseCaseScenario{ { Scenario: model.UseCaseScenarioSupportType(1), @@ -88,7 +83,7 @@ func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC usecase := usecase.NewUseCaseBase( localEntity, - model.UseCaseActorTypeGridConnectionPoint, + model.UseCaseActorTypeMonitoringAppliance, model.UseCaseNameTypeMonitoringOfGridConnectionPoint, "1.0.0", "release", @@ -96,7 +91,9 @@ func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC eventCB, UseCaseSupportUpdate, validActorTypes, - validEntityTypes) + nil, + true, + ) uc := &MGCP{ UseCaseBase: usecase, @@ -110,15 +107,16 @@ func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC func (m *MGCP) AddFeatures() { // server features deviceConfigurationFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceConfiguration, model.RoleTypeServer) + measurementFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) + electricalConnectionFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) + deviceConfigurationFeature.AddFunctionType(model.FunctionTypeDeviceConfigurationKeyValueDescriptionListData, true, false) deviceConfigurationFeature.AddFunctionType(model.FunctionTypeDeviceConfigurationKeyValueListData, true, false) - measurementFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) measurementFeature.AddFunctionType(model.FunctionTypeMeasurementDescriptionListData, true, false) measurementFeature.AddFunctionType(model.FunctionTypeMeasurementConstraintsListData, true, false) measurementFeature.AddFunctionType(model.FunctionTypeMeasurementListData, true, false) - electricalConnectionFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeElectricalConnection, model.RoleTypeServer) electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionDescriptionListData, true, false) electricalConnectionFeature.AddFunctionType(model.FunctionTypeElectricalConnectionParameterDescriptionListData, true, false) @@ -299,43 +297,17 @@ func (m *MGCP) AddFeatures() { panic("failed to add electrical connection parameter description") } - err = m.SetPvFeedInLimitationFactor(0.0) - if err != nil { - panic(err) - } - - for _, meas := range []*model.MeasurementIdType{ - m.acPowerTotal, - m.gridFeedIn, - m.gridConsumption, - m.acCurrent[0], m.acCurrent[1], m.acCurrent[2], - m.acVoltage[0], m.acVoltage[1], m.acVoltage[2], - m.acFrequency, - } { - err = m.setMeasurementDataForId(meas, 0.0) - if err != nil { - panic(err) - } - } -} - -func (m *MGCP) setMeasurementDataForId(id *model.MeasurementIdType, value float64) error { - measurements, err := server.NewMeasurement(m.LocalEntity) - if err != nil { - return err - } - - err = measurements.UpdateDataForId(model.MeasurementDataType{ - MeasurementId: id, - ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), - Timestamp: model.NewAbsoluteOrRelativeTimeTypeFromTime(time.Now()), - Value: model.NewScaledNumberType(value), - ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueState: util.Ptr(model.MeasurementValueStateTypeNormal), - }, nil, *id) - if err != nil { - return err - } - - return nil + m.Update( // TODO: optional? + m.ConfigurationPvFeedInLimitationFactor(0.0), + m.MeasurementAcPowerTotal(0.0), + m.MeasurementAcEnergyFeedIn(0.0), + m.MeasurementAcEnergyConsumed(0.0), + m.MeasurementAcCurrentPhaseA(0.0), + m.MeasurementAcCurrentPhaseB(0.0), + m.MeasurementAcCurrentPhaseC(0.0), + m.MeasurementAcVoltagePhaseA(0.0), + m.MeasurementAcVoltagePhaseB(0.0), + m.MeasurementAcVoltagePhaseC(0.0), + m.MeasurementAcFrequency(0.0), + ) } From 1bad42c928ef9b26948fe1f000d8855099f0152f Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 16 Oct 2024 08:20:22 +0200 Subject: [PATCH 44/61] Create config types --- usecases/gcp/mgcp/config.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 usecases/gcp/mgcp/config.go diff --git a/usecases/gcp/mgcp/config.go b/usecases/gcp/mgcp/config.go new file mode 100644 index 00000000..efb3a943 --- /dev/null +++ b/usecases/gcp/mgcp/config.go @@ -0,0 +1,22 @@ +package mgcp + +import "github.com/enbility/spine-go/model" + +type MonitorPvFeedInPowerLimitationFactorConfig struct { +} + +type MonitorPowerConfig struct { + ValueConstraints *model.MeasurementConstraintsDataType +} + +type MonitorEnergyConfig struct { +} + +type MonitorCurrentConfig struct { +} + +type MonitorVoltageConfig struct { +} + +type MonitorFrequencyConfig struct { +} From 93a158475671896d19109118b8168f72a918a430 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 16 Oct 2024 09:03:24 +0200 Subject: [PATCH 45/61] Update the mgcp config to match the specs. --- usecases/gcp/mgcp/config.go | 44 ++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/usecases/gcp/mgcp/config.go b/usecases/gcp/mgcp/config.go index efb3a943..a542b51f 100644 --- a/usecases/gcp/mgcp/config.go +++ b/usecases/gcp/mgcp/config.go @@ -2,21 +2,63 @@ package mgcp import "github.com/enbility/spine-go/model" +// MonitorPvFeedInPowerLimitationFactorConfig is the configuration for the power limitation factor monitoring use case in the MGCP +// If this config is passed via NewMGCP, the MGCP use case will support power limitation factor monitoring type MonitorPvFeedInPowerLimitationFactorConfig struct { } +// MonitorPowerConfig is the configuration for the power monitoring use case in the MGCP +// This config is required by the MGCP use case and must be used in NewMGCP type MonitorPowerConfig struct { - ValueConstraints *model.MeasurementConstraintsDataType + ValueSource *model.MeasurementValueSourceType // The source of the values from the acPowerTotal (not optional) + ValueConstraints *model.MeasurementConstraintsDataType // The constraints for the acPowerTotal (optional, can be nil) } +// MonitorEnergyConfig is the configuration for the energy monitoring use case in the MGCP +// This config is required by the MGCP use case and must be used in NewMGCP type MonitorEnergyConfig struct { + ValueSourceProduction *model.MeasurementValueSourceType // The source of the production values (not optional) + ValueSourceConsumption *model.MeasurementValueSourceType // The source of the consumption values (not optional) + + ValueConstraintsProduction *model.MeasurementConstraintsDataType // The constraints for the production values (optional, can be nil) + ValueConstraintsConsumption *model.MeasurementConstraintsDataType // The constraints for the consumption values (optional, can be nil) } +// MonitorCurrentConfig is the configuration for the current monitoring use case in the MGCP +// If this config is passed via NewMGCP, the MGCP use case will support current monitoring type MonitorCurrentConfig struct { + ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values for phase A (not optional) + ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values for phase B (not optional) + ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values for phase C (not optional) + + ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the current for phase A (optional, can be nil) + ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the current for phase B (optional, can be nil) + ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the current for phase C (optional, can be nil) } +// MonitorVoltageConfig is the configuration for the voltage monitoring use case in the MGCP +// If this config is passed via NewMGCP, the MGCP use case will support voltage monitoring type MonitorVoltageConfig struct { + // If the value source is not nil, the use case will support the voltage monitoring for the respective phase + // If the value source is nil, the use case will not support the voltage monitoring for the respective phase + ValueSourcePhaseA *model.MeasurementValueSourceType // The source of the values for phase A (optional, can be nil) + ValueSourcePhaseB *model.MeasurementValueSourceType // The source of the values for phase B (optional, can be nil) + ValueSourcePhaseC *model.MeasurementValueSourceType // The source of the values for phase C (optional, can be nil) + ValueSourcePhaseAToB *model.MeasurementValueSourceType // The source of the values for phase A to B (optional, can be nil) + ValueSourcePhaseBToC *model.MeasurementValueSourceType // The source of the values for phase B to C (optional, can be nil) + ValueSourcePhaseCToA *model.MeasurementValueSourceType // The source of the values for phase C to A (optional, can be nil) + + ValueConstraintsPhaseA *model.MeasurementConstraintsDataType // The constraints for the voltage for phase A (optional, can be nil) (needs ValueSourcePhaseA to be set) + ValueConstraintsPhaseB *model.MeasurementConstraintsDataType // The constraints for the voltage for phase B (optional, can be nil) (needs ValueSourcePhaseB to be set) + ValueConstraintsPhaseC *model.MeasurementConstraintsDataType // The constraints for the voltage for phase C (optional, can be nil) (needs ValueSourcePhaseC to be set) + ValueConstraintsPhaseAToB *model.MeasurementConstraintsDataType // The constraints for the voltage for phase A to B (optional, can be nil) (needs ValueSourcePhaseAToB to be set) + ValueConstraintsPhaseBToC *model.MeasurementConstraintsDataType // The constraints for the voltage for phase B to C (optional, can be nil) (needs ValueSourcePhaseBToC to be set) + ValueConstraintsPhaseCToA *model.MeasurementConstraintsDataType // The constraints for the voltage for phase C to A (optional, can be nil) (needs ValueSourcePhaseCToA to be set) } +// MonitorFrequencyConfig is the configuration for the frequency monitoring use case in the MGCP +// If this config is passed via NewMGCP, the MGCP use case will support frequency monitoring type MonitorFrequencyConfig struct { + ValueSource *model.MeasurementValueSourceType // The source of the values (not optional) + ValueConstraints *model.MeasurementConstraintsDataType // The constraints for the frequency values (optional can be nil) } From d175f9ed7eb179bcd824371fd680db2f489b1a23 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 16 Oct 2024 10:33:06 +0200 Subject: [PATCH 46/61] implement the mgcp with the mpc server standard --- usecases/api/gcp_mgcp.go | 239 ++++++++++++++ usecases/gcp/mgcp/model_helper.go | 31 -- usecases/gcp/mgcp/public.go | 532 ++++++++++++++++++++++-------- usecases/gcp/mgcp/update.go | 66 ++++ usecases/gcp/mgcp/usecase.go | 59 +++- 5 files changed, 740 insertions(+), 187 deletions(-) create mode 100644 usecases/api/gcp_mgcp.go delete mode 100644 usecases/gcp/mgcp/model_helper.go create mode 100644 usecases/gcp/mgcp/update.go diff --git a/usecases/api/gcp_mgcp.go b/usecases/api/gcp_mgcp.go new file mode 100644 index 00000000..12c95d1d --- /dev/null +++ b/usecases/api/gcp_mgcp.go @@ -0,0 +1,239 @@ +package api + +import ( + "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/usecases/gcp/mgcp" + "github.com/enbility/spine-go/model" + "time" +) + +type GcpMGCPInterface interface { + api.UseCaseInterface + + // ------------------------- Getters ------------------------- // + + // Scenario 1 + + // get the current power limitation factor + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + GetPowerLimitationFactor() (float64, error) + + // Scenario 2 + + // get the momentary power consumption or production at the grid connection point + // + // return values: + // - positive values are used for consumption + // - negative values are used for production + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + GetPowerTotal() (float64, error) + + // Scenario 3 + + // get the total feed in energy at the grid connection point + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + GetEnergyFeedIn() (float64, error) + + // Scenario 4 + + // get the total consumption energy at the grid connection point + // + // possible errors: + // - ErrDataNotAvailable if no such limit is (yet) available + // - and others + GetEnergyConsumed() (float64, error) + + // Scenario 5 + + // get the momentary phase specific current consumption or production + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + GetCurrentPerPhase() ([]float64, error) + + // Scenario 6 + + // get the momentary phase specific voltage consumption or production + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + GetVoltagePerPhase() ([]float64, error) + + // Scenario 7 + + // get frequency + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + GetFrequency() (float64, error) + + // ------------------------- Setters ------------------------- // + + // Update the data + + // use Update to update the data of the MGCP Usecase + // use it like this: + // + // mgcp.Update( + // mgcp.MeasuredAcPowerTotal(1000, nil, nil), + // mgcp.MeasuredAcPowerPhaseA(500, nil, nil), + // ... + // ) + // + // possible errors: + // - ErrMissingData if the id is not available + // - and others + Update(updateValueTypes ...mgcp.UpdateValueType) error + + // Scenario 1 + + // Use PowerLimitationFactor in Update to set the current power limitation factor + PowerLimitationFactor(value float64) mgcp.UpdateValueType + + // Scenario 2 + + // Use MeasurementAcPowerTotal in Update to set the momentary power consumption or production at the grid connection point + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + MeasurementAcPowerTotal( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + ) mgcp.UpdateValueType + + // Scenario 3 + + // Use MeasurementEnergyFeedIn in Update to set the total feed in energy at the grid connection point + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + // The evaluationPeriodStart and evaluationPeriodEnd are optional and can be nil (both must be set to be used) + MeasurementAcEnergyFeedIn( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + evaluationPeriodStart *time.Time, + evaluationPeriodEnd *time.Time, + ) mgcp.UpdateValueType + + // Scenario 4 + + // Use MeasurementEnergyConsumed in Update to set the total consumption energy at the grid connection point + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + // The evaluationPeriodStart and evaluationPeriodEnd are optional and can be nil (both must be set to be used) + MeasurementAcEnergyConsumed( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + evaluationPeriodStart *time.Time, + evaluationPeriodEnd *time.Time, + ) mgcp.UpdateValueType + + // Scenario 5 + + // Use MeasurementAcCurrentPhaseA in Update to set the momentary phase specific current consumption or production + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + MeasurementAcCurrentPhaseA( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + ) mgcp.UpdateValueType + + // Use MeasurementAcCurrentPhaseB in Update to set the momentary phase specific current consumption or production + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + MeasurementAcCurrentPhaseB( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + ) mgcp.UpdateValueType + + // Use MeasurementAcCurrentPhaseC in Update to set the momentary phase specific current consumption or production + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + MeasurementAcCurrentPhaseC( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + ) mgcp.UpdateValueType + + // Scenario 6 + + // Use MeasurementAcVoltagePhaseA in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + MeasurementAcVoltagePhaseA( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + ) mgcp.UpdateValueType + + // Use MeasurementAcVoltagePhaseB in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + MeasurementAcVoltagePhaseB( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + ) mgcp.UpdateValueType + + // Use MeasurementAcVoltagePhaseC in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + MeasurementAcVoltagePhaseC( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + ) mgcp.UpdateValueType + + // Use MeasurementAcVoltagePhaseAToB in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + MeasurementAcVoltagePhaseAToB( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + ) mgcp.UpdateValueType + + // Use MeasurementAcVoltagePhaseBToC in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + MeasurementAcVoltagePhaseBToC( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + ) mgcp.UpdateValueType + + // Use MeasurementAcVoltagePhaseCToA in Update to set the phase specific voltage details + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + MeasurementAcVoltagePhaseCToA( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + ) mgcp.UpdateValueType + + // Scenario 7 + + // Use MeasurementAcFrequency in Update to set the frequency + // The timestamp is optional and can be nil + // The valueState shall be set if it differs from the normal valueState otherwise it can be nil + MeasurementAcFrequency( + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + ) mgcp.UpdateValueType +} diff --git a/usecases/gcp/mgcp/model_helper.go b/usecases/gcp/mgcp/model_helper.go deleted file mode 100644 index f8148759..00000000 --- a/usecases/gcp/mgcp/model_helper.go +++ /dev/null @@ -1,31 +0,0 @@ -package mgcp - -import ( - "github.com/enbility/eebus-go/api" - "github.com/enbility/spine-go/model" - "github.com/enbility/spine-go/util" - "time" -) - -type SupportedUpdateValueType int - -const ( - SupportedUpdateValueTypeMeasurement SupportedUpdateValueType = 0 - SupportedUpdateValueTypeConfiguration SupportedUpdateValueType = 1 -) - -type UpdateValueType struct { - updateValueType SupportedUpdateValueType - updateTypeMeasurement api.MeasurementDataForID - updateTypeConfiguration model.DeviceConfigurationKeyValueDataType -} - -func measuredValue(value float64) model.MeasurementDataType { - return model.MeasurementDataType{ - ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), - Timestamp: model.NewAbsoluteOrRelativeTimeTypeFromTime(time.Now()), - Value: model.NewScaledNumberType(value), - ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), - ValueState: util.Ptr(model.MeasurementValueStateTypeNormal), - } -} diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go index d8dda29e..fb901ba4 100644 --- a/usecases/gcp/mgcp/public.go +++ b/usecases/gcp/mgcp/public.go @@ -1,185 +1,137 @@ package mgcp import ( + "errors" "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" "github.com/enbility/spine-go/model" + "time" ) // -------- Getters -------- // -// -------- Setters -------- // - // Scenario 1 -// Use MGCP.ConfigurationPvFeedInLimitationFactor in MGCP.Update to set the current power limitation factor -func (m *MGCP) ConfigurationPvFeedInLimitationFactor(pvFeedInLimitationFactor float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeConfiguration, - updateTypeConfiguration: model.DeviceConfigurationKeyValueDataType{ - KeyId: m.pvFeedInLimitationFactor, - Value: &model.DeviceConfigurationKeyValueValueType{ - ScaledNumber: model.NewScaledNumberType(pvFeedInLimitationFactor), - }, - }, +// get the current power limitation factor +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (m *MGCP) GetPowerLimitationFactor() (float64, error) { + _configurations, err := server.NewDeviceConfiguration(m.LocalEntity) + if err != nil { + return 0, err + } + + value, err := _configurations.GetKeyValueDataForKeyId(*m.pvFeedInLimitationFactor) + + if err != nil { + return 0, err } + + return value.Value.ScaledNumber.GetValue(), nil } // Scenario 2 -// Use MGCP.MeasurementAcPowerTotal in MGCP.Update to set the current total power -func (m *MGCP) MeasurementAcPowerTotal(acPowerTotal float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(acPowerTotal), - Id: *m.acPowerTotal, - }, - } +// get the momentary active power consumption or production +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (m *MGCP) GetPowerTotal() (float64, error) { + return m.getMeasurementDataForId(m.acPowerTotal) } // Scenario 3 -// Use MGCP.MeasurementAcEnergyFeedIn in MGCP.Update to set the total feed in energy -func (m *MGCP) MeasurementAcEnergyFeedIn(energy float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(energy), - Id: *m.gridFeedIn, - }, - } +// get the total produced energy +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (m *MGCP) GetEnergyFeedIn() (float64, error) { + return m.getMeasurementDataForId(m.gridFeedIn) } // Scenario 4 -// Use MGCP.MeasurementAcEnergyConsumed in MGCP.Update to set the total feed in energy -func (m *MGCP) MeasurementAcEnergyConsumed(energy float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(energy), - Id: *m.gridConsumption, - }, - } +// get the total consumed energy +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (m *MGCP) GetEnergyConsumed() (float64, error) { + return m.getMeasurementDataForId(m.gridConsumption) } // Scenario 5 -// Use MGCP.MeasurementAcCurrentPhaseA in MGCP.Update to set the current of phase A -func (m *MGCP) MeasurementAcCurrentPhaseA(current float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(current), - Id: *m.acCurrent[0], - }, +// get the momentary phase specific current consumption or production +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (m *MGCP) GetCurrentPerPhase() ([]float64, error) { + acCurrent := make([]float64, 0) + + for _, id := range m.acCurrent { + if id != nil { + value, err := m.getMeasurementDataForId(id) + if err != nil { + return nil, err + } + acCurrent = append(acCurrent, value) + } } -} -// Use MGCP.MeasurementAcCurrentPhaseB in MGCP.Update to set the current of phase B -func (m *MGCP) MeasurementAcCurrentPhaseB(current float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(current), - Id: *m.acCurrent[1], - }, + if len(acCurrent) == 0 { + return nil, api.ErrDataNotAvailable } -} -// Use MGCP.MeasurementAcCurrentPhaseC in MGCP.Update to set the current of phase C -func (m *MGCP) MeasurementAcCurrentPhaseC(current float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(current), - Id: *m.acCurrent[2], - }, - } + return acCurrent, nil } // Scenario 6 -// Use MGCP.MeasurementAcVoltagePhaseA in MGCP.Update to set the voltage of phase A -func (m *MGCP) MeasurementAcVoltagePhaseA(voltage float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(voltage), - Id: *m.acVoltage[0], - }, - } -} - -// Use MGCP.MeasurementAcVoltagePhaseB in MGCP.Update to set the voltage of phase B -func (m *MGCP) MeasurementAcVoltagePhaseB(voltage float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(voltage), - Id: *m.acVoltage[1], - }, +// get the momentary phase specific voltage consumption or production +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (m *MGCP) GetVoltagePerPhase() ([]float64, error) { + acVoltage := make([]float64, 0) + + for _, id := range m.acVoltage { + if id != nil { + value, err := m.getMeasurementDataForId(id) + if err != nil { + return nil, err + } + acVoltage = append(acVoltage, value) + } } -} -// Use MGCP.MeasurementAcVoltagePhaseC in MGCP.Update to set the voltage of phase C -func (m *MGCP) MeasurementAcVoltagePhaseC(voltage float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(voltage), - Id: *m.acVoltage[2], - }, + if len(acVoltage) == 0 { + return nil, api.ErrDataNotAvailable } -} -// Use MGCP.MeasurementAcVoltagePhaseAToB in MGCP.Update to set the voltage between phase A and B -func (m *MGCP) MeasurementAcVoltagePhaseAToB(voltage float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(voltage), - Id: *m.acVoltage[3], - }, - } -} - -// Use MGCP.MeasurementAcVoltagePhaseBToC in MGCP.Update to set the voltage between phase B and C -func (m *MGCP) MeasurementAcVoltagePhaseBToC(voltage float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(voltage), - Id: *m.acVoltage[4], - }, - } -} - -// Use MGCP.MeasurementAcVoltagePhaseCToA in MGCP.Update to set the voltage between phase C and A -func (m *MGCP) MeasurementAcVoltagePhaseCToA(voltage float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(voltage), - Id: *m.acVoltage[5], - }, - } + return acVoltage, nil } // Scenario 7 -// Use MGCP.MeasurementAcFrequency in MGCP.Update to set the frequency -func (m *MGCP) MeasurementAcFrequency(frequency float64) UpdateValueType { - return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ - Data: measuredValue(frequency), - Id: *m.acFrequency, - }, - } +// get frequency +// +// possible errors: +// - ErrMissingData if the id is not available +// - and others +func (m *MGCP) GetFrequency() (float64, error) { + return m.getMeasurementDataForId(m.acFrequency) } +// -------- Setters -------- // + // Update the data // use MPC.Update to update the data of the MGCP Usecase @@ -194,10 +146,9 @@ func (m *MGCP) MeasurementAcFrequency(frequency float64) UpdateValueType { // possible errors: // - ErrMissingData if the id is not available // - and others -func (m *MGCP) Update(updateValueType ...UpdateValueType) []error { +func (m *MGCP) Update(updateValueType ...UpdateValueType) error { measurements := make([]api.MeasurementDataForID, 0) configurations := make([]model.DeviceConfigurationKeyValueDataType, 0) - errors := make([]error, 0) for _, update := range updateValueType { if update.updateValueType == SupportedUpdateValueTypeMeasurement { @@ -210,26 +161,323 @@ func (m *MGCP) Update(updateValueType ...UpdateValueType) []error { if len(measurements) > 0 { _measurements, err := server.NewMeasurement(m.LocalEntity) if err != nil { - errors = append(errors, err) + return err } err = _measurements.UpdateDataForIds(measurements) if err != nil { - errors = append(errors, err) + return err } } if len(configurations) == 1 { _configurations, err := server.NewDeviceConfiguration(m.LocalEntity) if err != nil { - errors = append(errors, err) + return err } err = _configurations.UpdateKeyValueDataForKeyId(configurations[0], nil, *configurations[0].KeyId) if err != nil { - errors = append(errors, err) + return err } + } else { + if len(configurations) > 1 { + return errors.New("only one PowerLimitationFactor update is supported at a time") + } + } + + return nil +} + +// Scenario 1 + +// Use MGCP.PowerLimitationFactor in MGCP.Update to set the current power limitation factor +func (m *MGCP) PowerLimitationFactor(pvFeedInLimitationFactor float64) UpdateValueType { + return UpdateValueType{ + updateValueType: SupportedUpdateValueTypeConfiguration, + updateTypeConfiguration: model.DeviceConfigurationKeyValueDataType{ + KeyId: m.pvFeedInLimitationFactor, + Value: &model.DeviceConfigurationKeyValueValueType{ + ScaledNumber: model.NewScaledNumberType(pvFeedInLimitationFactor), + }, + }, } +} + +// Scenario 2 + +// Use MGCP.MeasurementAcPowerTotal in MGCP.Update to set the current total power +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (m *MGCP) MeasurementAcPowerTotal( + acPowerTotal float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcPowerTotal", + m.acPowerTotal, + m.powerConfig.ValueSource, + acPowerTotal, + timestamp, + valueState, + nil, + nil, + ) +} + +// Scenario 3 - return errors +// Use MGCP.MeasurementAcEnergyFeedIn in MGCP.Update to set the total feed in energy +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +// The evaluationPeriodStart and evaluationPeriodEnd are optional and can be nil (both must be set to be used) +func (m *MGCP) MeasurementAcEnergyFeedIn( + energy float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + evaluationPeriodStart *time.Time, + evaluationPeriodEnd *time.Time, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcEnergyFeedIn", + m.gridFeedIn, + m.energyConfig.ValueSourceProduction, + energy, + timestamp, + valueState, + evaluationPeriodStart, + evaluationPeriodEnd, + ) +} + +// Scenario 4 + +// Use MGCP.MeasurementAcEnergyConsumed in MGCP.Update to set the total feed in energy +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +// The evaluationPeriodStart and evaluationPeriodEnd are optional and can be nil (both must be set to be used) +func (m *MGCP) MeasurementAcEnergyConsumed( + energy float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + evaluationPeriodStart *time.Time, + evaluationPeriodEnd *time.Time, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcEnergyConsumed", + m.gridConsumption, + m.energyConfig.ValueSourceConsumption, + energy, + timestamp, + valueState, + evaluationPeriodStart, + evaluationPeriodEnd, + ) +} + +// Scenario 5 + +// Use MGCP.MeasurementAcCurrentPhaseA in MGCP.Update to set the current of phase A +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (m *MGCP) MeasurementAcCurrentPhaseA( + current float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcCurrentPhaseA", + m.acCurrent[0], + m.currentConfig.ValueSourcePhaseA, + current, + timestamp, + valueState, + nil, + nil, + ) +} + +// Use MGCP.MeasurementAcCurrentPhaseB in MGCP.Update to set the current of phase B +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (m *MGCP) MeasurementAcCurrentPhaseB( + current float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcCurrentPhaseB", + m.acCurrent[1], + m.currentConfig.ValueSourcePhaseB, + current, + timestamp, + valueState, + nil, + nil, + ) +} + +// Use MGCP.MeasurementAcCurrentPhaseC in MGCP.Update to set the current of phase C +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (m *MGCP) MeasurementAcCurrentPhaseC( + current float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcCurrentPhaseC", + m.acCurrent[2], + m.currentConfig.ValueSourcePhaseC, + current, + timestamp, + valueState, + nil, + nil, + ) +} + +// Scenario 6 + +// Use MGCP.MeasurementAcVoltagePhaseA in MGCP.Update to set the voltage of phase A +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (m *MGCP) MeasurementAcVoltagePhaseA( + voltage float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcVoltagePhaseA", + m.acVoltage[0], + m.voltageConfig.ValueSourcePhaseA, + voltage, + timestamp, + valueState, + nil, + nil, + ) +} + +// Use MGCP.MeasurementAcVoltagePhaseB in MGCP.Update to set the voltage of phase B +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (m *MGCP) MeasurementAcVoltagePhaseB( + voltage float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcVoltagePhaseB", + m.acVoltage[1], + m.voltageConfig.ValueSourcePhaseB, + voltage, + timestamp, + valueState, + nil, + nil, + ) +} + +// Use MGCP.MeasurementAcVoltagePhaseC in MGCP.Update to set the voltage of phase C +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (m *MGCP) MeasurementAcVoltagePhaseC( + voltage float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcVoltagePhaseC", + m.acVoltage[2], + m.voltageConfig.ValueSourcePhaseC, + voltage, + timestamp, + valueState, + nil, + nil, + ) +} + +// Use MGCP.MeasurementAcVoltagePhaseAToB in MGCP.Update to set the voltage between phase A and B +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (m *MGCP) MeasurementAcVoltagePhaseAToB( + voltage float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcVoltagePhaseAToB", + m.acVoltage[3], + m.voltageConfig.ValueSourcePhaseAToB, + voltage, + timestamp, + valueState, + nil, + nil, + ) +} + +// Use MGCP.MeasurementAcVoltagePhaseBToC in MGCP.Update to set the voltage between phase B and C +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (m *MGCP) MeasurementAcVoltagePhaseBToC( + voltage float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcVoltagePhaseBToC", + m.acVoltage[4], + m.voltageConfig.ValueSourcePhaseBToC, + voltage, + timestamp, + valueState, + nil, + nil, + ) +} + +// Use MGCP.MeasurementAcVoltagePhaseCToA in MGCP.Update to set the voltage between phase C and A +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (m *MGCP) MeasurementAcVoltagePhaseCToA( + voltage float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcVoltagePhaseCToA", + m.acVoltage[5], + m.voltageConfig.ValueSourcePhaseCToA, + voltage, + timestamp, + valueState, + nil, + nil, + ) +} + +// Scenario 7 + +// Use MGCP.MeasurementAcFrequency in MGCP.Update to set the frequency +// The timestamp is optional and can be nil +// The valueState shall be set if it differs from the normal valueState otherwise it can be nil +func (m *MGCP) MeasurementAcFrequency( + frequency float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, +) UpdateValueType { + return measurementUpdateValueType( + "MeasurementAcFrequency", + m.acFrequency, + m.frequencyConfig.ValueSource, + frequency, + timestamp, + valueState, + nil, + nil, + ) } diff --git a/usecases/gcp/mgcp/update.go b/usecases/gcp/mgcp/update.go new file mode 100644 index 00000000..a22bc80a --- /dev/null +++ b/usecases/gcp/mgcp/update.go @@ -0,0 +1,66 @@ +package mgcp + +import ( + "fmt" + "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" + "time" +) + +type SupportedUpdateValueType int + +const ( + SupportedUpdateValueTypeMeasurement SupportedUpdateValueType = 0 + SupportedUpdateValueTypeConfiguration SupportedUpdateValueType = 1 +) + +type UpdateValueType struct { + updateValueType SupportedUpdateValueType + updateTypeMeasurement api.MeasurementDataForID + updateTypeConfiguration model.DeviceConfigurationKeyValueDataType +} + +func measurementUpdateValueType( + errorName string, + id *model.MeasurementIdType, + valueSource *model.MeasurementValueSourceType, + value float64, + timestamp *time.Time, + valueState *model.MeasurementValueStateType, + evaluationStart *time.Time, + evaluationEnd *time.Time, +) UpdateValueType { + if id == nil { + panic(fmt.Sprintf("%s is not supported by the use case MGCP, please check the MGCP configuration", errorName)) + } + + updateValueType := UpdateValueType{ + updateValueType: SupportedUpdateValueTypeMeasurement, + updateTypeMeasurement: api.MeasurementDataForID{ + Id: *id, + Data: model.MeasurementDataType{ + ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), + ValueSource: valueSource, + Value: model.NewScaledNumberType(value), + }, + }, + } + + if timestamp != nil { + updateValueType.updateTypeMeasurement.Data.Timestamp = model.NewAbsoluteOrRelativeTimeTypeFromTime(*timestamp) + } + + if valueState != nil { + updateValueType.updateTypeMeasurement.Data.ValueState = valueState + } + + if evaluationStart != nil && evaluationEnd != nil { + updateValueType.updateTypeMeasurement.Data.EvaluationPeriod = &model.TimePeriodType{ + StartTime: model.NewAbsoluteOrRelativeTimeTypeFromTime(*evaluationStart), + EndTime: model.NewAbsoluteOrRelativeTimeTypeFromTime(*evaluationEnd), + } + } + + return updateValueType +} diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index 82bcd190..a929e990 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -13,6 +13,13 @@ import ( type MGCP struct { *usecase.UseCaseBase + limitationConfig *MonitorPvFeedInPowerLimitationFactorConfig + powerConfig *MonitorPowerConfig + energyConfig *MonitorEnergyConfig + currentConfig *MonitorCurrentConfig + voltageConfig *MonitorVoltageConfig + frequencyConfig *MonitorFrequencyConfig + pvFeedInLimitationFactor *model.DeviceConfigurationKeyIdType acPowerTotal *model.MeasurementIdType gridFeedIn *model.MeasurementIdType @@ -23,7 +30,16 @@ type MGCP struct { } // At the moment the MGCP use case configures itself as a 3-phase meter by default (ABC). -func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback) *MGCP { +func NewMGCP( + localEntity spineapi.EntityLocalInterface, + eventCB api.EntityEventCallback, + monitorFeedInLimitationConfig *MonitorPvFeedInPowerLimitationFactorConfig, + monitorPowerConfig *MonitorPowerConfig, + monitorEnergyConfig *MonitorEnergyConfig, + monitorCurrentConfig *MonitorCurrentConfig, + monitorVoltageConfig *MonitorVoltageConfig, + monitorFrequencyConfig *MonitorFrequencyConfig, +) *MGCP { validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeGridConnectionPoint} useCaseScenarios := []api.UseCaseScenario{ { @@ -97,6 +113,13 @@ func NewMGCP(localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventC uc := &MGCP{ UseCaseBase: usecase, + + limitationConfig: monitorFeedInLimitationConfig, + powerConfig: monitorPowerConfig, + energyConfig: monitorEnergyConfig, + currentConfig: monitorCurrentConfig, + voltageConfig: monitorVoltageConfig, + frequencyConfig: monitorFrequencyConfig, } _ = spine.Events.Subscribe(uc) @@ -296,18 +319,26 @@ func (m *MGCP) AddFeatures() { idP52 == nil || idP53 == nil || idP6 == nil { panic("failed to add electrical connection parameter description") } +} - m.Update( // TODO: optional? - m.ConfigurationPvFeedInLimitationFactor(0.0), - m.MeasurementAcPowerTotal(0.0), - m.MeasurementAcEnergyFeedIn(0.0), - m.MeasurementAcEnergyConsumed(0.0), - m.MeasurementAcCurrentPhaseA(0.0), - m.MeasurementAcCurrentPhaseB(0.0), - m.MeasurementAcCurrentPhaseC(0.0), - m.MeasurementAcVoltagePhaseA(0.0), - m.MeasurementAcVoltagePhaseB(0.0), - m.MeasurementAcVoltagePhaseC(0.0), - m.MeasurementAcFrequency(0.0), - ) +func (m *MGCP) getMeasurementDataForId(id *model.MeasurementIdType) (float64, error) { + if id == nil { + return 0, api.ErrMissingData + } + + measurements, err := server.NewMeasurement(m.LocalEntity) + if err != nil { + return 0, err + } + + data, err := measurements.GetDataForId(*id) + if err != nil { + return 0, err + } + + if data == nil { + return 0, api.ErrDataNotAvailable + } + + return data.Value.GetValue(), nil } From 751fc6d38558bf2ee161cbb437f55fecf7ed6e8f Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Thu, 17 Oct 2024 08:24:38 +0200 Subject: [PATCH 47/61] fix import circle --- usecases/api/gcp_mgcp.go | 41 ++++++++++++++++++++++++------------- usecases/gcp/mgcp/public.go | 37 ++++++++++++++++++--------------- usecases/gcp/mgcp/update.go | 26 +++++++++++++++-------- 3 files changed, 64 insertions(+), 40 deletions(-) diff --git a/usecases/api/gcp_mgcp.go b/usecases/api/gcp_mgcp.go index 12c95d1d..a141e160 100644 --- a/usecases/api/gcp_mgcp.go +++ b/usecases/api/gcp_mgcp.go @@ -100,7 +100,7 @@ type GcpMGCPInterface interface { // Scenario 1 // Use PowerLimitationFactor in Update to set the current power limitation factor - PowerLimitationFactor(value float64) mgcp.UpdateValueType + PowerLimitationFactor(value float64) GcpMGCPUpdateValueTypeInterface // Scenario 2 @@ -111,7 +111,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Scenario 3 @@ -125,7 +125,7 @@ type GcpMGCPInterface interface { valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Scenario 4 @@ -139,7 +139,7 @@ type GcpMGCPInterface interface { valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Scenario 5 @@ -150,7 +150,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Use MeasurementAcCurrentPhaseB in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil @@ -159,7 +159,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Use MeasurementAcCurrentPhaseC in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil @@ -168,7 +168,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Scenario 6 @@ -179,7 +179,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Use MeasurementAcVoltagePhaseB in Update to set the phase specific voltage details // The timestamp is optional and can be nil @@ -188,7 +188,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Use MeasurementAcVoltagePhaseC in Update to set the phase specific voltage details // The timestamp is optional and can be nil @@ -197,7 +197,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Use MeasurementAcVoltagePhaseAToB in Update to set the phase specific voltage details // The timestamp is optional and can be nil @@ -206,7 +206,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Use MeasurementAcVoltagePhaseBToC in Update to set the phase specific voltage details // The timestamp is optional and can be nil @@ -215,7 +215,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Use MeasurementAcVoltagePhaseCToA in Update to set the phase specific voltage details // The timestamp is optional and can be nil @@ -224,7 +224,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface // Scenario 7 @@ -235,5 +235,18 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) mgcp.UpdateValueType + ) GcpMGCPUpdateValueTypeInterface +} + +type GcpMGCPUpdateValueTypeType int + +const ( + GcpMGCPUpdateValueTypeTypeMeasurement GcpMGCPUpdateValueTypeType = 0 + GcpMGCPUpdateValueTypeTypeConfiguration GcpMGCPUpdateValueTypeType = 1 +) + +type GcpMGCPUpdateValueTypeInterface interface { + GetUpdateValueTypeType() GcpMGCPUpdateValueTypeType + GetUpdateValueTypeMeasurement() api.MeasurementDataForID + GetUpdateValueTypeConfiguration() model.DeviceConfigurationKeyValueDataType } diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go index fb901ba4..44e54ffd 100644 --- a/usecases/gcp/mgcp/public.go +++ b/usecases/gcp/mgcp/public.go @@ -4,6 +4,7 @@ import ( "errors" "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" + usecaseapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/spine-go/model" "time" ) @@ -151,10 +152,12 @@ func (m *MGCP) Update(updateValueType ...UpdateValueType) error { configurations := make([]model.DeviceConfigurationKeyValueDataType, 0) for _, update := range updateValueType { - if update.updateValueType == SupportedUpdateValueTypeMeasurement { + if update.updateValueTypeType == usecaseapi.GcpMGCPUpdateValueTypeTypeMeasurement { measurements = append(measurements, update.updateTypeMeasurement) - } else { + } else if update.updateValueTypeType == usecaseapi.GcpMGCPUpdateValueTypeTypeConfiguration { configurations = append(configurations, update.updateTypeConfiguration) + } else { + return errors.New("unknown UpdateValueTypeType: " + string(rune(update.updateValueTypeType))) } } @@ -192,9 +195,9 @@ func (m *MGCP) Update(updateValueType ...UpdateValueType) error { // Scenario 1 // Use MGCP.PowerLimitationFactor in MGCP.Update to set the current power limitation factor -func (m *MGCP) PowerLimitationFactor(pvFeedInLimitationFactor float64) UpdateValueType { +func (m *MGCP) PowerLimitationFactor(pvFeedInLimitationFactor float64) usecaseapi.GcpMGCPUpdateValueTypeInterface { return UpdateValueType{ - updateValueType: SupportedUpdateValueTypeConfiguration, + updateValueTypeType: usecaseapi.GcpMGCPUpdateValueTypeTypeMeasurement, updateTypeConfiguration: model.DeviceConfigurationKeyValueDataType{ KeyId: m.pvFeedInLimitationFactor, Value: &model.DeviceConfigurationKeyValueValueType{ @@ -213,7 +216,7 @@ func (m *MGCP) MeasurementAcPowerTotal( acPowerTotal float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcPowerTotal", m.acPowerTotal, @@ -238,7 +241,7 @@ func (m *MGCP) MeasurementAcEnergyFeedIn( valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcEnergyFeedIn", m.gridFeedIn, @@ -263,7 +266,7 @@ func (m *MGCP) MeasurementAcEnergyConsumed( valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcEnergyConsumed", m.gridConsumption, @@ -285,7 +288,7 @@ func (m *MGCP) MeasurementAcCurrentPhaseA( current float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcCurrentPhaseA", m.acCurrent[0], @@ -305,7 +308,7 @@ func (m *MGCP) MeasurementAcCurrentPhaseB( current float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcCurrentPhaseB", m.acCurrent[1], @@ -325,7 +328,7 @@ func (m *MGCP) MeasurementAcCurrentPhaseC( current float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcCurrentPhaseC", m.acCurrent[2], @@ -347,7 +350,7 @@ func (m *MGCP) MeasurementAcVoltagePhaseA( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcVoltagePhaseA", m.acVoltage[0], @@ -367,7 +370,7 @@ func (m *MGCP) MeasurementAcVoltagePhaseB( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcVoltagePhaseB", m.acVoltage[1], @@ -387,7 +390,7 @@ func (m *MGCP) MeasurementAcVoltagePhaseC( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcVoltagePhaseC", m.acVoltage[2], @@ -407,7 +410,7 @@ func (m *MGCP) MeasurementAcVoltagePhaseAToB( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcVoltagePhaseAToB", m.acVoltage[3], @@ -427,7 +430,7 @@ func (m *MGCP) MeasurementAcVoltagePhaseBToC( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcVoltagePhaseBToC", m.acVoltage[4], @@ -447,7 +450,7 @@ func (m *MGCP) MeasurementAcVoltagePhaseCToA( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcVoltagePhaseCToA", m.acVoltage[5], @@ -469,7 +472,7 @@ func (m *MGCP) MeasurementAcFrequency( frequency float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) UpdateValueType { +) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( "MeasurementAcFrequency", m.acFrequency, diff --git a/usecases/gcp/mgcp/update.go b/usecases/gcp/mgcp/update.go index a22bc80a..cf61c3fa 100644 --- a/usecases/gcp/mgcp/update.go +++ b/usecases/gcp/mgcp/update.go @@ -3,24 +3,32 @@ package mgcp import ( "fmt" "github.com/enbility/eebus-go/api" + usecaseapi "github.com/enbility/eebus-go/usecases/api" "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/util" "time" ) -type SupportedUpdateValueType int - -const ( - SupportedUpdateValueTypeMeasurement SupportedUpdateValueType = 0 - SupportedUpdateValueTypeConfiguration SupportedUpdateValueType = 1 -) - type UpdateValueType struct { - updateValueType SupportedUpdateValueType + updateValueTypeType usecaseapi.GcpMGCPUpdateValueTypeType updateTypeMeasurement api.MeasurementDataForID updateTypeConfiguration model.DeviceConfigurationKeyValueDataType } +func (u UpdateValueType) GetUpdateValueTypeType() usecaseapi.GcpMGCPUpdateValueTypeType { + return u.updateValueTypeType +} + +func (u UpdateValueType) GetUpdateValueTypeMeasurement() api.MeasurementDataForID { + return u.updateTypeMeasurement +} + +func (u UpdateValueType) GetUpdateValueTypeConfiguration() model.DeviceConfigurationKeyValueDataType { + return u.updateTypeConfiguration +} + +var _ usecaseapi.GcpMGCPUpdateValueTypeInterface = (*UpdateValueType)(nil) + func measurementUpdateValueType( errorName string, id *model.MeasurementIdType, @@ -36,7 +44,7 @@ func measurementUpdateValueType( } updateValueType := UpdateValueType{ - updateValueType: SupportedUpdateValueTypeMeasurement, + updateValueTypeType: usecaseapi.GcpMGCPUpdateValueTypeTypeMeasurement, updateTypeMeasurement: api.MeasurementDataForID{ Id: *id, Data: model.MeasurementDataType{ From eb28b1a70603e88ec8d7c727d6520ae7bedf36a7 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Thu, 17 Oct 2024 08:34:29 +0200 Subject: [PATCH 48/61] fix import circle 2 --- usecases/api/gcp_mgcp.go | 3 +-- usecases/gcp/mgcp/public.go | 13 +++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/usecases/api/gcp_mgcp.go b/usecases/api/gcp_mgcp.go index a141e160..1dfca9a8 100644 --- a/usecases/api/gcp_mgcp.go +++ b/usecases/api/gcp_mgcp.go @@ -2,7 +2,6 @@ package api import ( "github.com/enbility/eebus-go/api" - "github.com/enbility/eebus-go/usecases/gcp/mgcp" "github.com/enbility/spine-go/model" "time" ) @@ -95,7 +94,7 @@ type GcpMGCPInterface interface { // possible errors: // - ErrMissingData if the id is not available // - and others - Update(updateValueTypes ...mgcp.UpdateValueType) error + Update(updateValueTypes ...GcpMGCPUpdateValueTypeInterface) error // Scenario 1 diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go index 44e54ffd..df65cb1e 100644 --- a/usecases/gcp/mgcp/public.go +++ b/usecases/gcp/mgcp/public.go @@ -147,17 +147,18 @@ func (m *MGCP) GetFrequency() (float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (m *MGCP) Update(updateValueType ...UpdateValueType) error { +func (m *MGCP) Update(updateValueType ...usecaseapi.GcpMGCPUpdateValueTypeInterface) error { measurements := make([]api.MeasurementDataForID, 0) configurations := make([]model.DeviceConfigurationKeyValueDataType, 0) for _, update := range updateValueType { - if update.updateValueTypeType == usecaseapi.GcpMGCPUpdateValueTypeTypeMeasurement { - measurements = append(measurements, update.updateTypeMeasurement) - } else if update.updateValueTypeType == usecaseapi.GcpMGCPUpdateValueTypeTypeConfiguration { - configurations = append(configurations, update.updateTypeConfiguration) + updateValueTypeType := update.GetUpdateValueTypeType() + if updateValueTypeType == usecaseapi.GcpMGCPUpdateValueTypeTypeMeasurement { + measurements = append(measurements, update.GetUpdateValueTypeMeasurement()) + } else if updateValueTypeType == usecaseapi.GcpMGCPUpdateValueTypeTypeConfiguration { + configurations = append(configurations, update.GetUpdateValueTypeConfiguration()) } else { - return errors.New("unknown UpdateValueTypeType: " + string(rune(update.updateValueTypeType))) + return errors.New("unknown UpdateValueTypeType: " + string(rune(updateValueTypeType))) } } From 37f137da2eb54d3a2d6eb95b521a263fd5517428 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Fri, 25 Oct 2024 09:33:17 +0200 Subject: [PATCH 49/61] new naming pattern to match the getters without the Get-prefix. --- usecases/api/gcp_mgcp.go | 66 ++++++++++++------------- usecases/gcp/mgcp/public.go | 96 ++++++++++++++++++------------------- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/usecases/api/gcp_mgcp.go b/usecases/api/gcp_mgcp.go index 1dfca9a8..bd77af55 100644 --- a/usecases/api/gcp_mgcp.go +++ b/usecases/api/gcp_mgcp.go @@ -18,7 +18,7 @@ type GcpMGCPInterface interface { // possible errors: // - ErrDataNotAvailable if no such limit is (yet) available // - and others - GetPowerLimitationFactor() (float64, error) + PowerLimitationFactor() (float64, error) // Scenario 2 @@ -31,7 +31,7 @@ type GcpMGCPInterface interface { // possible errors: // - ErrDataNotAvailable if no such limit is (yet) available // - and others - GetPowerTotal() (float64, error) + PowerTotal() (float64, error) // Scenario 3 @@ -40,7 +40,7 @@ type GcpMGCPInterface interface { // possible errors: // - ErrDataNotAvailable if no such limit is (yet) available // - and others - GetEnergyFeedIn() (float64, error) + EnergyFeedIn() (float64, error) // Scenario 4 @@ -49,7 +49,7 @@ type GcpMGCPInterface interface { // possible errors: // - ErrDataNotAvailable if no such limit is (yet) available // - and others - GetEnergyConsumed() (float64, error) + EnergyConsumed() (float64, error) // Scenario 5 @@ -58,7 +58,7 @@ type GcpMGCPInterface interface { // possible errors: // - ErrMissingData if the id is not available // - and others - GetCurrentPerPhase() ([]float64, error) + CurrentPerPhase() ([]float64, error) // Scenario 6 @@ -67,7 +67,7 @@ type GcpMGCPInterface interface { // possible errors: // - ErrMissingData if the id is not available // - and others - GetVoltagePerPhase() ([]float64, error) + VoltagePerPhase() ([]float64, error) // Scenario 7 @@ -76,7 +76,7 @@ type GcpMGCPInterface interface { // possible errors: // - ErrMissingData if the id is not available // - and others - GetFrequency() (float64, error) + Frequency() (float64, error) // ------------------------- Setters ------------------------- // @@ -98,15 +98,15 @@ type GcpMGCPInterface interface { // Scenario 1 - // Use PowerLimitationFactor in Update to set the current power limitation factor - PowerLimitationFactor(value float64) GcpMGCPUpdateValueTypeInterface + // Use UpdateDataPowerLimitationFactor in Update to set the current power limitation factor + UpdateDataPowerLimitationFactor(value float64) GcpMGCPUpdateValueTypeInterface // Scenario 2 - // Use MeasurementAcPowerTotal in Update to set the momentary power consumption or production at the grid connection point + // Use UpdateDataPowerTotal in Update to set the momentary power consumption or production at the grid connection point // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - MeasurementAcPowerTotal( + UpdateDataPowerTotal( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, @@ -118,7 +118,7 @@ type GcpMGCPInterface interface { // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil // The evaluationPeriodStart and evaluationPeriodEnd are optional and can be nil (both must be set to be used) - MeasurementAcEnergyFeedIn( + UpdateDataEnergyFeedIn( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, @@ -132,7 +132,7 @@ type GcpMGCPInterface interface { // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil // The evaluationPeriodStart and evaluationPeriodEnd are optional and can be nil (both must be set to be used) - MeasurementAcEnergyConsumed( + UpdateDataEnergyConsumed( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, @@ -142,28 +142,28 @@ type GcpMGCPInterface interface { // Scenario 5 - // Use MeasurementAcCurrentPhaseA in Update to set the momentary phase specific current consumption or production + // Use UpdateDataCurrentPhaseA in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - MeasurementAcCurrentPhaseA( + UpdateDataCurrentPhaseA( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) GcpMGCPUpdateValueTypeInterface - // Use MeasurementAcCurrentPhaseB in Update to set the momentary phase specific current consumption or production + // Use UpdateDataCurrentPhaseB in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - MeasurementAcCurrentPhaseB( + UpdateDataCurrentPhaseB( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) GcpMGCPUpdateValueTypeInterface - // Use MeasurementAcCurrentPhaseC in Update to set the momentary phase specific current consumption or production + // Use UpdateDataCurrentPhaseC in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - MeasurementAcCurrentPhaseC( + UpdateDataCurrentPhaseC( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, @@ -171,55 +171,55 @@ type GcpMGCPInterface interface { // Scenario 6 - // Use MeasurementAcVoltagePhaseA in Update to set the phase specific voltage details + // Use UpdateDataVoltagePhaseA in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - MeasurementAcVoltagePhaseA( + UpdateDataVoltagePhaseA( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) GcpMGCPUpdateValueTypeInterface - // Use MeasurementAcVoltagePhaseB in Update to set the phase specific voltage details + // Use UpdateDataVoltagePhaseB in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - MeasurementAcVoltagePhaseB( + UpdateDataVoltagePhaseB( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) GcpMGCPUpdateValueTypeInterface - // Use MeasurementAcVoltagePhaseC in Update to set the phase specific voltage details + // Use UpdateDataVoltagePhaseC in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - MeasurementAcVoltagePhaseC( + UpdateDataVoltagePhaseC( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) GcpMGCPUpdateValueTypeInterface - // Use MeasurementAcVoltagePhaseAToB in Update to set the phase specific voltage details + // Use UpdateDataVoltagePhaseAToB in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - MeasurementAcVoltagePhaseAToB( + UpdateDataVoltagePhaseAToB( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) GcpMGCPUpdateValueTypeInterface - // Use MeasurementAcVoltagePhaseBToC in Update to set the phase specific voltage details + // Use UpdateDataVoltagePhaseBToC in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - MeasurementAcVoltagePhaseBToC( + UpdateDataVoltagePhaseBToC( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) GcpMGCPUpdateValueTypeInterface - // Use MeasurementAcVoltagePhaseCToA in Update to set the phase specific voltage details + // Use UpdateDataVoltagePhaseCToA in Update to set the phase specific voltage details // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - MeasurementAcVoltagePhaseCToA( + UpdateDataVoltagePhaseCToA( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, @@ -227,10 +227,10 @@ type GcpMGCPInterface interface { // Scenario 7 - // Use MeasurementAcFrequency in Update to set the frequency + // Use UpdateDataFrequency in Update to set the frequency // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil - MeasurementAcFrequency( + UpdateDataFrequency( value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go index df65cb1e..2e26b434 100644 --- a/usecases/gcp/mgcp/public.go +++ b/usecases/gcp/mgcp/public.go @@ -18,7 +18,7 @@ import ( // possible errors: // - ErrMissingData if the id is not available // - and others -func (m *MGCP) GetPowerLimitationFactor() (float64, error) { +func (m *MGCP) PowerLimitationFactor() (float64, error) { _configurations, err := server.NewDeviceConfiguration(m.LocalEntity) if err != nil { return 0, err @@ -40,7 +40,7 @@ func (m *MGCP) GetPowerLimitationFactor() (float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (m *MGCP) GetPowerTotal() (float64, error) { +func (m *MGCP) PowerTotal() (float64, error) { return m.getMeasurementDataForId(m.acPowerTotal) } @@ -51,7 +51,7 @@ func (m *MGCP) GetPowerTotal() (float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (m *MGCP) GetEnergyFeedIn() (float64, error) { +func (m *MGCP) EnergyFeedIn() (float64, error) { return m.getMeasurementDataForId(m.gridFeedIn) } @@ -62,7 +62,7 @@ func (m *MGCP) GetEnergyFeedIn() (float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (m *MGCP) GetEnergyConsumed() (float64, error) { +func (m *MGCP) EnergyConsumed() (float64, error) { return m.getMeasurementDataForId(m.gridConsumption) } @@ -73,7 +73,7 @@ func (m *MGCP) GetEnergyConsumed() (float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (m *MGCP) GetCurrentPerPhase() ([]float64, error) { +func (m *MGCP) CurrentPerPhase() ([]float64, error) { acCurrent := make([]float64, 0) for _, id := range m.acCurrent { @@ -100,7 +100,7 @@ func (m *MGCP) GetCurrentPerPhase() ([]float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (m *MGCP) GetVoltagePerPhase() ([]float64, error) { +func (m *MGCP) VoltagePerPhase() ([]float64, error) { acVoltage := make([]float64, 0) for _, id := range m.acVoltage { @@ -127,7 +127,7 @@ func (m *MGCP) GetVoltagePerPhase() ([]float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (m *MGCP) GetFrequency() (float64, error) { +func (m *MGCP) Frequency() (float64, error) { return m.getMeasurementDataForId(m.acFrequency) } @@ -195,8 +195,8 @@ func (m *MGCP) Update(updateValueType ...usecaseapi.GcpMGCPUpdateValueTypeInterf // Scenario 1 -// Use MGCP.PowerLimitationFactor in MGCP.Update to set the current power limitation factor -func (m *MGCP) PowerLimitationFactor(pvFeedInLimitationFactor float64) usecaseapi.GcpMGCPUpdateValueTypeInterface { +// Use MGCP.UpdateDataPowerLimitationFactor in MGCP.Update to set the current power limitation factor +func (m *MGCP) UpdateDataPowerLimitationFactor(pvFeedInLimitationFactor float64) usecaseapi.GcpMGCPUpdateValueTypeInterface { return UpdateValueType{ updateValueTypeType: usecaseapi.GcpMGCPUpdateValueTypeTypeMeasurement, updateTypeConfiguration: model.DeviceConfigurationKeyValueDataType{ @@ -210,16 +210,16 @@ func (m *MGCP) PowerLimitationFactor(pvFeedInLimitationFactor float64) usecaseap // Scenario 2 -// Use MGCP.MeasurementAcPowerTotal in MGCP.Update to set the current total power +// Use MGCP.UpdateDataPowerTotal in MGCP.Update to set the current total power // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (m *MGCP) MeasurementAcPowerTotal( +func (m *MGCP) UpdateDataPowerTotal( acPowerTotal float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcPowerTotal", + "UpdateDataPowerTotal", m.acPowerTotal, m.powerConfig.ValueSource, acPowerTotal, @@ -232,11 +232,11 @@ func (m *MGCP) MeasurementAcPowerTotal( // Scenario 3 -// Use MGCP.MeasurementAcEnergyFeedIn in MGCP.Update to set the total feed in energy +// Use MGCP.UpdateDataEnergyFeedIn in MGCP.Update to set the total feed in energy // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil // The evaluationPeriodStart and evaluationPeriodEnd are optional and can be nil (both must be set to be used) -func (m *MGCP) MeasurementAcEnergyFeedIn( +func (m *MGCP) UpdateDataEnergyFeedIn( energy float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, @@ -244,7 +244,7 @@ func (m *MGCP) MeasurementAcEnergyFeedIn( evaluationPeriodEnd *time.Time, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcEnergyFeedIn", + "UpdateDataEnergyFeedIn", m.gridFeedIn, m.energyConfig.ValueSourceProduction, energy, @@ -257,11 +257,11 @@ func (m *MGCP) MeasurementAcEnergyFeedIn( // Scenario 4 -// Use MGCP.MeasurementAcEnergyConsumed in MGCP.Update to set the total feed in energy +// Use MGCP.UpdateDataEnergyConsumed in MGCP.Update to set the total feed in energy // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil // The evaluationPeriodStart and evaluationPeriodEnd are optional and can be nil (both must be set to be used) -func (m *MGCP) MeasurementAcEnergyConsumed( +func (m *MGCP) UpdateDataEnergyConsumed( energy float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, @@ -269,7 +269,7 @@ func (m *MGCP) MeasurementAcEnergyConsumed( evaluationPeriodEnd *time.Time, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcEnergyConsumed", + "UpdateDataEnergyConsumed", m.gridConsumption, m.energyConfig.ValueSourceConsumption, energy, @@ -282,16 +282,16 @@ func (m *MGCP) MeasurementAcEnergyConsumed( // Scenario 5 -// Use MGCP.MeasurementAcCurrentPhaseA in MGCP.Update to set the current of phase A +// Use MGCP.UpdateDataCurrentPhaseA in MGCP.Update to set the current of phase A // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (m *MGCP) MeasurementAcCurrentPhaseA( +func (m *MGCP) UpdateDataCurrentPhaseA( current float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcCurrentPhaseA", + "UpdateDataCurrentPhaseA", m.acCurrent[0], m.currentConfig.ValueSourcePhaseA, current, @@ -302,16 +302,16 @@ func (m *MGCP) MeasurementAcCurrentPhaseA( ) } -// Use MGCP.MeasurementAcCurrentPhaseB in MGCP.Update to set the current of phase B +// Use MGCP.UpdateDataCurrentPhaseB in MGCP.Update to set the current of phase B // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (m *MGCP) MeasurementAcCurrentPhaseB( +func (m *MGCP) UpdateDataCurrentPhaseB( current float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcCurrentPhaseB", + "UpdateDataCurrentPhaseB", m.acCurrent[1], m.currentConfig.ValueSourcePhaseB, current, @@ -322,16 +322,16 @@ func (m *MGCP) MeasurementAcCurrentPhaseB( ) } -// Use MGCP.MeasurementAcCurrentPhaseC in MGCP.Update to set the current of phase C +// Use MGCP.UpdateDataCurrentPhaseC in MGCP.Update to set the current of phase C // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (m *MGCP) MeasurementAcCurrentPhaseC( +func (m *MGCP) UpdateDataCurrentPhaseC( current float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcCurrentPhaseC", + "UpdateDataCurrentPhaseC", m.acCurrent[2], m.currentConfig.ValueSourcePhaseC, current, @@ -344,16 +344,16 @@ func (m *MGCP) MeasurementAcCurrentPhaseC( // Scenario 6 -// Use MGCP.MeasurementAcVoltagePhaseA in MGCP.Update to set the voltage of phase A +// Use MGCP.UpdateDataVoltagePhaseA in MGCP.Update to set the voltage of phase A // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (m *MGCP) MeasurementAcVoltagePhaseA( +func (m *MGCP) UpdateDataVoltagePhaseA( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcVoltagePhaseA", + "UpdateDataVoltagePhaseA", m.acVoltage[0], m.voltageConfig.ValueSourcePhaseA, voltage, @@ -364,16 +364,16 @@ func (m *MGCP) MeasurementAcVoltagePhaseA( ) } -// Use MGCP.MeasurementAcVoltagePhaseB in MGCP.Update to set the voltage of phase B +// Use MGCP.UpdateDataVoltagePhaseB in MGCP.Update to set the voltage of phase B // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (m *MGCP) MeasurementAcVoltagePhaseB( +func (m *MGCP) UpdateDataVoltagePhaseB( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcVoltagePhaseB", + "UpdateDataVoltagePhaseB", m.acVoltage[1], m.voltageConfig.ValueSourcePhaseB, voltage, @@ -384,16 +384,16 @@ func (m *MGCP) MeasurementAcVoltagePhaseB( ) } -// Use MGCP.MeasurementAcVoltagePhaseC in MGCP.Update to set the voltage of phase C +// Use MGCP.UpdateDataVoltagePhaseC in MGCP.Update to set the voltage of phase C // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (m *MGCP) MeasurementAcVoltagePhaseC( +func (m *MGCP) UpdateDataVoltagePhaseC( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcVoltagePhaseC", + "UpdateDataVoltagePhaseC", m.acVoltage[2], m.voltageConfig.ValueSourcePhaseC, voltage, @@ -404,16 +404,16 @@ func (m *MGCP) MeasurementAcVoltagePhaseC( ) } -// Use MGCP.MeasurementAcVoltagePhaseAToB in MGCP.Update to set the voltage between phase A and B +// Use MGCP.UpdateDataVoltagePhaseAToB in MGCP.Update to set the voltage between phase A and B // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (m *MGCP) MeasurementAcVoltagePhaseAToB( +func (m *MGCP) UpdateDataVoltagePhaseAToB( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcVoltagePhaseAToB", + "UpdateDataVoltagePhaseAToB", m.acVoltage[3], m.voltageConfig.ValueSourcePhaseAToB, voltage, @@ -424,16 +424,16 @@ func (m *MGCP) MeasurementAcVoltagePhaseAToB( ) } -// Use MGCP.MeasurementAcVoltagePhaseBToC in MGCP.Update to set the voltage between phase B and C +// Use MGCP.UpdateDataVoltagePhaseBToC in MGCP.Update to set the voltage between phase B and C // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (m *MGCP) MeasurementAcVoltagePhaseBToC( +func (m *MGCP) UpdateDataVoltagePhaseBToC( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcVoltagePhaseBToC", + "UpdateDataVoltagePhaseBToC", m.acVoltage[4], m.voltageConfig.ValueSourcePhaseBToC, voltage, @@ -444,16 +444,16 @@ func (m *MGCP) MeasurementAcVoltagePhaseBToC( ) } -// Use MGCP.MeasurementAcVoltagePhaseCToA in MGCP.Update to set the voltage between phase C and A +// Use MGCP.UpdateDataVoltagePhaseCToA in MGCP.Update to set the voltage between phase C and A // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (m *MGCP) MeasurementAcVoltagePhaseCToA( +func (m *MGCP) UpdateDataVoltagePhaseCToA( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcVoltagePhaseCToA", + "UpdateDataVoltagePhaseCToA", m.acVoltage[5], m.voltageConfig.ValueSourcePhaseCToA, voltage, @@ -466,16 +466,16 @@ func (m *MGCP) MeasurementAcVoltagePhaseCToA( // Scenario 7 -// Use MGCP.MeasurementAcFrequency in MGCP.Update to set the frequency +// Use MGCP.UpdateDataFrequency in MGCP.Update to set the frequency // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil -func (m *MGCP) MeasurementAcFrequency( +func (m *MGCP) UpdateDataFrequency( frequency float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, ) usecaseapi.GcpMGCPUpdateValueTypeInterface { return measurementUpdateValueType( - "MeasurementAcFrequency", + "UpdateDataFrequency", m.acFrequency, m.frequencyConfig.ValueSource, frequency, From a32fe8eb0248cde5d4f162754b7b9d991ebebce2 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Fri, 25 Oct 2024 12:28:58 +0200 Subject: [PATCH 50/61] add test files --- usecases/gcp/mgcp/public_test.go | 1 + usecases/gcp/mgcp/testhelper_test.go | 1 + 2 files changed, 2 insertions(+) create mode 100644 usecases/gcp/mgcp/public_test.go create mode 100644 usecases/gcp/mgcp/testhelper_test.go diff --git a/usecases/gcp/mgcp/public_test.go b/usecases/gcp/mgcp/public_test.go new file mode 100644 index 00000000..0fb914f7 --- /dev/null +++ b/usecases/gcp/mgcp/public_test.go @@ -0,0 +1 @@ +package mgcp diff --git a/usecases/gcp/mgcp/testhelper_test.go b/usecases/gcp/mgcp/testhelper_test.go new file mode 100644 index 00000000..0fb914f7 --- /dev/null +++ b/usecases/gcp/mgcp/testhelper_test.go @@ -0,0 +1 @@ +package mgcp From 504ec45698aec9d925006f67a2ada3a908577d50 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Mon, 28 Oct 2024 09:04:50 +0100 Subject: [PATCH 51/61] Create tests for the default mgcp --- usecases/api/gcp_mgcp.go | 4 +- usecases/gcp/mgcp/public.go | 2 +- usecases/gcp/mgcp/public_test.go | 93 +++++++++++++++++++++++ usecases/gcp/mgcp/testhelper_test.go | 108 +++++++++++++++++++++++++++ 4 files changed, 204 insertions(+), 3 deletions(-) diff --git a/usecases/api/gcp_mgcp.go b/usecases/api/gcp_mgcp.go index bd77af55..6a75c665 100644 --- a/usecases/api/gcp_mgcp.go +++ b/usecases/api/gcp_mgcp.go @@ -114,7 +114,7 @@ type GcpMGCPInterface interface { // Scenario 3 - // Use MeasurementEnergyFeedIn in Update to set the total feed in energy at the grid connection point + // Use UpdateDataEnergyFeedIn in Update to set the total feed in energy at the grid connection point // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil // The evaluationPeriodStart and evaluationPeriodEnd are optional and can be nil (both must be set to be used) @@ -128,7 +128,7 @@ type GcpMGCPInterface interface { // Scenario 4 - // Use MeasurementEnergyConsumed in Update to set the total consumption energy at the grid connection point + // Use UpdateDataEnergyConsumed in Update to set the total consumption energy at the grid connection point // The timestamp is optional and can be nil // The valueState shall be set if it differs from the normal valueState otherwise it can be nil // The evaluationPeriodStart and evaluationPeriodEnd are optional and can be nil (both must be set to be used) diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go index 2e26b434..95c0f041 100644 --- a/usecases/gcp/mgcp/public.go +++ b/usecases/gcp/mgcp/public.go @@ -198,7 +198,7 @@ func (m *MGCP) Update(updateValueType ...usecaseapi.GcpMGCPUpdateValueTypeInterf // Use MGCP.UpdateDataPowerLimitationFactor in MGCP.Update to set the current power limitation factor func (m *MGCP) UpdateDataPowerLimitationFactor(pvFeedInLimitationFactor float64) usecaseapi.GcpMGCPUpdateValueTypeInterface { return UpdateValueType{ - updateValueTypeType: usecaseapi.GcpMGCPUpdateValueTypeTypeMeasurement, + updateValueTypeType: usecaseapi.GcpMGCPUpdateValueTypeTypeConfiguration, updateTypeConfiguration: model.DeviceConfigurationKeyValueDataType{ KeyId: m.pvFeedInLimitationFactor, Value: &model.DeviceConfigurationKeyValueValueType{ diff --git a/usecases/gcp/mgcp/public_test.go b/usecases/gcp/mgcp/public_test.go index 0fb914f7..d1559834 100644 --- a/usecases/gcp/mgcp/public_test.go +++ b/usecases/gcp/mgcp/public_test.go @@ -1 +1,94 @@ package mgcp + +import "github.com/stretchr/testify/assert" + +func (s *GcpMpcgSuite) Test_PowerLimitationFactor() { + err := s.sut.Update( + s.sut.UpdateDataPowerLimitationFactor(0.5), + ) + + assert.Nil(s.T(), err) + + powerLimitationFactor, err := s.sut.PowerLimitationFactor() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 0.5, powerLimitationFactor) +} + +func (s *GcpMpcgSuite) Test_PowerTotal() { + err := s.sut.Update( + s.sut.UpdateDataPowerTotal(5.0, nil, nil), + ) + + assert.Nil(s.T(), err) + + totalPower, err := s.sut.PowerTotal() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, totalPower) +} + +func (s *GcpMpcgSuite) Test_EnergyConsumed() { + err := s.sut.Update( + s.sut.UpdateDataEnergyConsumed(5.0, nil, nil, nil, nil), + ) + + assert.Nil(s.T(), err) + + energyConsumed, err := s.sut.EnergyConsumed() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, energyConsumed) +} + +func (s *GcpMpcgSuite) Test_EnergyFeedIn() { + err := s.sut.Update( + s.sut.UpdateDataEnergyFeedIn(6.0, nil, nil, nil, nil), + ) + + assert.Nil(s.T(), err) + + energyProduced, err := s.sut.EnergyFeedIn() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 6.0, energyProduced) +} + +func (s *GcpMpcgSuite) Test_CurrentPerPhase() { + err := s.sut.Update( + s.sut.UpdateDataCurrentPhaseA(5.0, nil, nil), + s.sut.UpdateDataCurrentPhaseB(6.0, nil, nil), + s.sut.UpdateDataCurrentPhaseC(7.0, nil, nil), + ) + + assert.Nil(s.T(), err) + + currentPerPhases, err := s.sut.CurrentPerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 6.0, 7.0}, currentPerPhases) +} + +func (s *GcpMpcgSuite) Test_VoltagePerPhase() { + err := s.sut.Update( + s.sut.UpdateDataVoltagePhaseA(5.0, nil, nil), + s.sut.UpdateDataVoltagePhaseB(6.0, nil, nil), + s.sut.UpdateDataVoltagePhaseC(7.0, nil, nil), + s.sut.UpdateDataVoltagePhaseAToB(8.0, nil, nil), + s.sut.UpdateDataVoltagePhaseBToC(9.0, nil, nil), + s.sut.UpdateDataVoltagePhaseCToA(10.0, nil, nil), + ) + + assert.Nil(s.T(), err) + + voltagePerPhases, err := s.sut.VoltagePerPhase() + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, voltagePerPhases) +} + +func (s *GcpMpcgSuite) Test_Frequency() { + err := s.sut.Update( + s.sut.UpdateDataFrequency(50.0, nil, nil), + ) + + assert.Nil(s.T(), err) + + frequency, err := s.sut.Frequency() + assert.Nil(s.T(), err) + assert.Equal(s.T(), 50.0, frequency) +} diff --git a/usecases/gcp/mgcp/testhelper_test.go b/usecases/gcp/mgcp/testhelper_test.go index 0fb914f7..8470108c 100644 --- a/usecases/gcp/mgcp/testhelper_test.go +++ b/usecases/gcp/mgcp/testhelper_test.go @@ -1 +1,109 @@ package mgcp + +import ( + "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/mocks" + "github.com/enbility/eebus-go/service" + shipapi "github.com/enbility/ship-go/api" + "github.com/enbility/ship-go/cert" + spineapi "github.com/enbility/spine-go/api" + spinemocks "github.com/enbility/spine-go/mocks" + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" + "testing" + "time" +) + +const remoteSki string = "testremoteski" + +func TestMuMPCSuite(t *testing.T) { + suite.Run(t, new(GcpMpcgSuite)) +} + +type GcpMpcgSuite struct { + suite.Suite + + sut *MGCP + + service api.ServiceInterface + + remoteDevice spineapi.DeviceRemoteInterface + mockRemoteEntity *spinemocks.EntityRemoteInterface + monitoredEntity spineapi.EntityRemoteInterface + loadControlFeature, + deviceDiagnosisFeature, + deviceConfigurationFeature spineapi.FeatureLocalInterface + + eventCalled bool +} + +func (s *GcpMpcgSuite) Event(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event api.EventType) { + s.eventCalled = true +} + +func (s *GcpMpcgSuite) BeforeTest(suiteName, testName string) { + s.eventCalled = false + cert, _ := cert.CreateCertificate("test", "test", "DE", "test") + configuration, _ := api.NewConfiguration( + "test", "test", "test", "test", + []shipapi.DeviceCategoryType{shipapi.DeviceCategoryTypeGridConnectionHub}, + model.DeviceTypeTypeEnergyManagementSystem, + []model.EntityTypeType{model.EntityTypeTypeInverter}, + 9999, cert, time.Second*4) + + serviceHandler := mocks.NewServiceReaderInterface(s.T()) + serviceHandler.EXPECT().ServicePairingDetailUpdate(mock.Anything, mock.Anything).Return().Maybe() + + s.service = service.NewService(configuration, serviceHandler) + _ = s.service.Setup() + + mockRemoteDevice := spinemocks.NewDeviceRemoteInterface(s.T()) + s.mockRemoteEntity = spinemocks.NewEntityRemoteInterface(s.T()) + mockRemoteFeature := spinemocks.NewFeatureRemoteInterface(s.T()) + mockRemoteDevice.EXPECT().FeatureByEntityTypeAndRole(mock.Anything, mock.Anything, mock.Anything).Return(mockRemoteFeature).Maybe() + mockRemoteDevice.EXPECT().Ski().Return(remoteSki).Maybe() + s.mockRemoteEntity.EXPECT().Device().Return(mockRemoteDevice).Maybe() + s.mockRemoteEntity.EXPECT().EntityType().Return(mock.Anything).Maybe() + entityAddress := &model.EntityAddressType{} + s.mockRemoteEntity.EXPECT().Address().Return(entityAddress).Maybe() + mockRemoteFeature.EXPECT().DataCopy(mock.Anything).Return(mock.Anything).Maybe() + mockRemoteFeature.EXPECT().Address().Return(&model.FeatureAddressType{}).Maybe() + mockRemoteFeature.EXPECT().Operations().Return(nil).Maybe() + + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + s.sut = NewMGCP( + localEntity, + s.Event, + &MonitorPvFeedInPowerLimitationFactorConfig{}, + &MonitorPowerConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + }, + &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorVoltageConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + ) + + s.sut.AddFeatures() + s.sut.AddUseCase() + + //s.remoteDevice, s.monitoredEntity = setupDevices(s.service, s.T()) +} From 998bc39c9dcaabfd569cdbc020c37866802b46f4 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Thu, 28 Nov 2024 14:40:09 +0100 Subject: [PATCH 52/61] Fit mgcp usecase to the requirements from the mpc usecase - add client filter tests - add usecase req/opt tests - split AddFeatures method - get the right electrical connection id --- usecases/gcp/mgcp/public_test.go | 104 +++- usecases/gcp/mgcp/testhelper_test.go | 93 +++- .../gcp/mgcp/{update.go => update_helper.go} | 0 usecases/gcp/mgcp/usecase.go | 451 +++++++++++++----- usecases/gcp/mgcp/usecase_test.go | 165 +++++++ 5 files changed, 676 insertions(+), 137 deletions(-) rename usecases/gcp/mgcp/{update.go => update_helper.go} (100%) create mode 100644 usecases/gcp/mgcp/usecase_test.go diff --git a/usecases/gcp/mgcp/public_test.go b/usecases/gcp/mgcp/public_test.go index d1559834..bdc37645 100644 --- a/usecases/gcp/mgcp/public_test.go +++ b/usecases/gcp/mgcp/public_test.go @@ -1,6 +1,11 @@ package mgcp -import "github.com/stretchr/testify/assert" +import ( + "github.com/enbility/eebus-go/features/server" + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" + "github.com/stretchr/testify/assert" +) func (s *GcpMpcgSuite) Test_PowerLimitationFactor() { err := s.sut.Update( @@ -12,6 +17,26 @@ func (s *GcpMpcgSuite) Test_PowerLimitationFactor() { powerLimitationFactor, err := s.sut.PowerLimitationFactor() assert.Nil(s.T(), err) assert.Equal(s.T(), 0.5, powerLimitationFactor) + + // Test client getter + keyname := model.DeviceConfigurationKeyNameTypePvCurtailmentLimitFactor + + deviceConfiguration, err := server.NewDeviceConfiguration(s.localEntity) + assert.Nil(s.T(), err) + + filter := model.DeviceConfigurationKeyValueDescriptionDataType{ + KeyName: &keyname, + } + + _, err = deviceConfiguration.GetKeyValueDescriptionsForFilter(filter) + assert.Nil(s.T(), err) + + filter.ValueType = util.Ptr(model.DeviceConfigurationKeyValueTypeTypeScaledNumber) + data, err := deviceConfiguration.GetKeyValueDataForFilter(filter) + assert.Nil(s.T(), err) + assert.NotNil(s.T(), data) + + assert.Equal(s.T(), 0.5, data.Value.ScaledNumber.GetValue()) } func (s *GcpMpcgSuite) Test_PowerTotal() { @@ -24,6 +49,17 @@ func (s *GcpMpcgSuite) Test_PowerTotal() { totalPower, err := s.sut.PowerTotal() assert.Nil(s.T(), err) assert.Equal(s.T(), 5.0, totalPower) + + // Test client getter + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypePower), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), + } + + data, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, nil) + assert.Nil(s.T(), err) + assert.Equal(s.T(), 5.0, data[0]) } func (s *GcpMpcgSuite) Test_EnergyConsumed() { @@ -36,6 +72,21 @@ func (s *GcpMpcgSuite) Test_EnergyConsumed() { energyConsumed, err := s.sut.EnergyConsumed() assert.Nil(s.T(), err) assert.Equal(s.T(), 5.0, energyConsumed) + + // Test client getter + measurement, err := server.NewMeasurement(s.localEntity) + assert.Nil(s.T(), err) + + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeGridConsumption), + } + + result, err := measurement.GetDataForFilter(filter) + assert.Nil(s.T(), err) + + assert.Equal(s.T(), 5.0, result[0].Value.GetValue()) } func (s *GcpMpcgSuite) Test_EnergyFeedIn() { @@ -48,6 +99,21 @@ func (s *GcpMpcgSuite) Test_EnergyFeedIn() { energyProduced, err := s.sut.EnergyFeedIn() assert.Nil(s.T(), err) assert.Equal(s.T(), 6.0, energyProduced) + + // Test client getter + measurement, err := server.NewMeasurement(s.localEntity) + assert.Nil(s.T(), err) + + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeGridFeedIn), + } + + result, err := measurement.GetDataForFilter(filter) + assert.Nil(s.T(), err) + + assert.Equal(s.T(), 6.0, result[0].Value.GetValue()) } func (s *GcpMpcgSuite) Test_CurrentPerPhase() { @@ -62,6 +128,17 @@ func (s *GcpMpcgSuite) Test_CurrentPerPhase() { currentPerPhases, err := s.sut.CurrentPerPhase() assert.Nil(s.T(), err) assert.Equal(s.T(), []float64{5.0, 6.0, 7.0}, currentPerPhases) + + // Test client getter + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), + } + + data, err := s.measurementPhaseSpecificDataForFilter(filter, model.EnergyDirectionTypeConsume, nil) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 6.0, 7.0}, data) } func (s *GcpMpcgSuite) Test_VoltagePerPhase() { @@ -79,6 +156,17 @@ func (s *GcpMpcgSuite) Test_VoltagePerPhase() { voltagePerPhases, err := s.sut.VoltagePerPhase() assert.Nil(s.T(), err) assert.Equal(s.T(), []float64{5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, voltagePerPhases) + + // Test client getter + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + } + + data, err := s.measurementPhaseSpecificDataForFilter(filter, "", nil) + assert.Nil(s.T(), err) + assert.Equal(s.T(), []float64{5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, data) } func (s *GcpMpcgSuite) Test_Frequency() { @@ -91,4 +179,18 @@ func (s *GcpMpcgSuite) Test_Frequency() { frequency, err := s.sut.Frequency() assert.Nil(s.T(), err) assert.Equal(s.T(), 50.0, frequency) + + // Test client getter + measurement, err := server.NewMeasurement(s.localEntity) + assert.Nil(s.T(), err) + + filter := model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), + } + + data, err := measurement.GetDataForFilter(filter) + assert.Nil(s.T(), err) + assert.Equal(s.T(), 50.0, data[0].Value.GetValue()) } diff --git a/usecases/gcp/mgcp/testhelper_test.go b/usecases/gcp/mgcp/testhelper_test.go index 8470108c..fc3cc5dc 100644 --- a/usecases/gcp/mgcp/testhelper_test.go +++ b/usecases/gcp/mgcp/testhelper_test.go @@ -2,6 +2,7 @@ package mgcp import ( "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/features/server" "github.com/enbility/eebus-go/mocks" "github.com/enbility/eebus-go/service" shipapi "github.com/enbility/ship-go/api" @@ -12,13 +13,14 @@ import ( "github.com/enbility/spine-go/util" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" + "slices" "testing" "time" ) const remoteSki string = "testremoteski" -func TestMuMPCSuite(t *testing.T) { +func TestMuMPCPublicSuite(t *testing.T) { suite.Run(t, new(GcpMpcgSuite)) } @@ -37,6 +39,7 @@ type GcpMpcgSuite struct { deviceConfigurationFeature spineapi.FeatureLocalInterface eventCalled bool + localEntity spineapi.EntityLocalInterface } func (s *GcpMpcgSuite) Event(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event api.EventType) { @@ -59,26 +62,18 @@ func (s *GcpMpcgSuite) BeforeTest(suiteName, testName string) { s.service = service.NewService(configuration, serviceHandler) _ = s.service.Setup() - mockRemoteDevice := spinemocks.NewDeviceRemoteInterface(s.T()) - s.mockRemoteEntity = spinemocks.NewEntityRemoteInterface(s.T()) - mockRemoteFeature := spinemocks.NewFeatureRemoteInterface(s.T()) - mockRemoteDevice.EXPECT().FeatureByEntityTypeAndRole(mock.Anything, mock.Anything, mock.Anything).Return(mockRemoteFeature).Maybe() - mockRemoteDevice.EXPECT().Ski().Return(remoteSki).Maybe() - s.mockRemoteEntity.EXPECT().Device().Return(mockRemoteDevice).Maybe() - s.mockRemoteEntity.EXPECT().EntityType().Return(mock.Anything).Maybe() - entityAddress := &model.EntityAddressType{} - s.mockRemoteEntity.EXPECT().Address().Return(entityAddress).Maybe() - mockRemoteFeature.EXPECT().DataCopy(mock.Anything).Return(mock.Anything).Maybe() - mockRemoteFeature.EXPECT().Address().Return(&model.FeatureAddressType{}).Maybe() - mockRemoteFeature.EXPECT().Operations().Return(nil).Maybe() - - localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) - s.sut = NewMGCP( - localEntity, + s.localEntity = s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + s.sut, _ = NewMGCP( + s.localEntity, s.Event, &MonitorPvFeedInPowerLimitationFactorConfig{}, &MonitorPowerConfig{ ValueSource: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), }, &MonitorEnergyConfig{ ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), @@ -102,8 +97,68 @@ func (s *GcpMpcgSuite) BeforeTest(suiteName, testName string) { }, ) - s.sut.AddFeatures() + _ = s.sut.AddFeatures() s.sut.AddUseCase() +} - //s.remoteDevice, s.monitoredEntity = setupDevices(s.service, s.T()) +func (s *GcpMpcgSuite) measurementPhaseSpecificDataForFilter( + measurementFilter model.MeasurementDescriptionDataType, + energyDirection model.EnergyDirectionType, + validPhaseNameTypes []model.ElectricalConnectionPhaseNameType, +) ([]float64, error) { + measurements, err := server.NewMeasurement(s.sut.LocalEntity) + if err != nil { + return nil, err + } + + electricalConnection, err := server.NewElectricalConnection(s.sut.LocalEntity) + if err != nil { + return nil, err + } + + data, err := measurements.GetDataForFilter(measurementFilter) + if err != nil || len(data) == 0 { + return nil, api.ErrDataNotAvailable + } + + var result []float64 + + for _, item := range data { + if item.Value == nil || item.MeasurementId == nil { + continue + } + + if validPhaseNameTypes != nil { + filter := model.ElectricalConnectionParameterDescriptionDataType{ + MeasurementId: item.MeasurementId, + } + param, err := electricalConnection.GetParameterDescriptionsForFilter(filter) + if err != nil || len(param) == 0 || + param[0].AcMeasuredPhases == nil || + !slices.Contains(validPhaseNameTypes, *param[0].AcMeasuredPhases) { + continue + } + } + + if energyDirection != "" { + filter := model.ElectricalConnectionParameterDescriptionDataType{ + MeasurementId: item.MeasurementId, + } + desc, err := electricalConnection.GetDescriptionForParameterDescriptionFilter(filter) + if err != nil || desc == nil { + continue + } + + // if energy direction is not consume + if desc.PositiveEnergyDirection == nil || *desc.PositiveEnergyDirection != energyDirection { + return nil, err + } + } + + value := item.Value.GetValue() + + result = append(result, value) + } + + return result, nil } diff --git a/usecases/gcp/mgcp/update.go b/usecases/gcp/mgcp/update_helper.go similarity index 100% rename from usecases/gcp/mgcp/update.go rename to usecases/gcp/mgcp/update_helper.go diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index a929e990..3087b141 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -1,6 +1,7 @@ package mgcp import ( + "errors" "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/features/server" "github.com/enbility/eebus-go/usecases/usecase" @@ -29,7 +30,22 @@ type MGCP struct { acFrequency *model.MeasurementIdType } -// At the moment the MGCP use case configures itself as a 3-phase meter by default (ABC). +// creates a new MGCP usecase instance for a MonitoredUnit entity +// +// parameters: +// - localEntity: the local entity for which the use case is created +// - eventCB: the callback function to be called when an event is triggered +// - monitorFeedInLimitationConfig: (optional) configuration parameters for MGCP scenario 1 +// - monitorPowerConfig: (required) configuration parameters for MGCP scenario 2 +// - monitorEnergyConfig: (required) configuration parameters for MGCP scenario 3 +// - monitorCurrentConfig: (optional) configuration parameters for MGCP scenario 4 +// - monitorVoltageConfig: (optional) configuration parameters for MGCP scenario 5 +// - monitorFrequencyConfig: (optional) configuration parameters for MGCP scenario 6 +// +// possible errors: +// - configuration error +// - and more... + func NewMGCP( localEntity spineapi.EntityLocalInterface, eventCB api.EntityEventCallback, @@ -39,7 +55,15 @@ func NewMGCP( monitorCurrentConfig *MonitorCurrentConfig, monitorVoltageConfig *MonitorVoltageConfig, monitorFrequencyConfig *MonitorFrequencyConfig, -) *MGCP { +) (*MGCP, error) { + if monitorPowerConfig == nil { + return nil, errors.New("monitorPowerConfig must be set") + } + + if monitorEnergyConfig == nil { + return nil, errors.New("monitorEnergyConfig must be set") + } + validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeGridConnectionPoint} useCaseScenarios := []api.UseCaseScenario{ { @@ -124,10 +148,10 @@ func NewMGCP( _ = spine.Events.Subscribe(uc) - return uc + return uc, nil } -func (m *MGCP) AddFeatures() { +func (m *MGCP) AddFeatures() error { // server features deviceConfigurationFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeDeviceConfiguration, model.RoleTypeServer) measurementFeature := m.LocalEntity.GetOrAddFeature(model.FeatureTypeTypeMeasurement, model.RoleTypeServer) @@ -145,180 +169,373 @@ func (m *MGCP) AddFeatures() { configuration, err := server.NewDeviceConfiguration(m.LocalEntity) if err != nil { - panic(err) + return err } - m.pvFeedInLimitationFactor = configuration.AddKeyValueDescription(model.DeviceConfigurationKeyValueDescriptionDataType{ + err = m.configurePvFeedInLimitationFactor(configuration) + if err != nil { + return err + } + + measurement, err := server.NewMeasurement(m.LocalEntity) + if err != nil { + return err + } + + electricalConnection, err := server.NewElectricalConnection(m.LocalEntity) + if err != nil { + return err + } + + electricalConnectionId, err := electricalConnection.GetOrAddIdForDescription(model.ElectricalConnectionDescriptionDataType{ + PowerSupplyType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + PositiveEnergyDirection: util.Ptr(model.EnergyDirectionTypeConsume), + }) + if err != nil { + return err + } + + constraints := make([]model.MeasurementConstraintsDataType, 0) + + configMethods := []func( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, + ) error{ + m.configureMonitorPower, + m.configureGridFeedIn, + m.configureGridConsumption, + m.configureMonitorCurrent, + m.configureMonitorVoltage, + m.configureMonitorFrequency, + } + + for _, configMethod := range configMethods { + if err := configMethod(measurement, electricalConnection, electricalConnectionId, &constraints); err != nil { + return err + } + } + + if len(constraints) > 0 { + measurementFeature.UpdateData( + model.FunctionTypeMeasurementConstraintsListData, + &model.MeasurementConstraintsListDataType{ + MeasurementConstraintsData: constraints, + }, nil, nil, + ) + } + + return nil +} + +func (m *MGCP) configurePvFeedInLimitationFactor( + configurations *server.DeviceConfiguration, +) error { + if m.limitationConfig == nil { + return nil + } + + m.pvFeedInLimitationFactor = configurations.AddKeyValueDescription(model.DeviceConfigurationKeyValueDescriptionDataType{ KeyName: util.Ptr(model.DeviceConfigurationKeyNameTypePvCurtailmentLimitFactor), ValueType: util.Ptr(model.DeviceConfigurationKeyValueTypeTypeScaledNumber), Unit: util.Ptr(model.UnitOfMeasurementTypepct), }) + if m.pvFeedInLimitationFactor == nil { - panic("failed to add key description") + return errors.New("failed to add key description") } - measurement, err := server.NewMeasurement(m.LocalEntity) - if err != nil { - panic(err) + return nil +} + +func (m *MGCP) configureMonitorPower( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, +) error { + if m.powerConfig == nil { + return errors.New("mgcp power config must be configured") + } + + if m.powerConfig.ValueSource == nil { + return errors.New("mgcp power config value source must be configured") } - m.acPowerTotal = measurement.AddDescription(model.MeasurementDescriptionDataType{ + m.acPowerTotal = measurements.AddDescription(model.MeasurementDescriptionDataType{ MeasurementType: util.Ptr(model.MeasurementTypeTypePower), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), Unit: util.Ptr(model.UnitOfMeasurementTypeW), ScopeType: util.Ptr(model.ScopeTypeTypeACPowerTotal), }) - m.gridFeedIn = measurement.AddDescription(model.MeasurementDescriptionDataType{ + parameterDescription := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: m.acPowerTotal, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeAbc), + AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) + + if parameterDescription == nil { + return errors.New("failed to add parameter description") + } + + if m.powerConfig.ValueConstraints != nil { + m.powerConfig.ValueConstraints.MeasurementId = m.acPowerTotal + *measurementsConstraintData = append(*measurementsConstraintData, *m.powerConfig.ValueConstraints) + } + + return nil +} + +func (m *MGCP) configureGridFeedIn( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, +) error { + if m.energyConfig == nil { + return errors.New("mgcp energy config must be configured") + } + + if m.energyConfig.ValueSourceProduction == nil { + return errors.New("mgcp energy config production value source must be configured") + } + + m.gridFeedIn = measurements.AddDescription(model.MeasurementDescriptionDataType{ MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), Unit: util.Ptr(model.UnitOfMeasurementTypeWh), ScopeType: util.Ptr(model.ScopeTypeTypeGridFeedIn), }) - m.gridConsumption = measurement.AddDescription(model.MeasurementDescriptionDataType{ + parameterDescription := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: m.gridFeedIn, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + }) + if parameterDescription == nil { + return errors.New("failed to add parameter description") + } + + if m.energyConfig.ValueConstraintsProduction != nil { + m.energyConfig.ValueConstraintsProduction.MeasurementId = m.gridFeedIn + *measurementsConstraintData = append(*measurementsConstraintData, *m.energyConfig.ValueConstraintsProduction) + } + + return nil +} + +func (m *MGCP) configureGridConsumption( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, +) error { + if m.energyConfig == nil { + return errors.New("mgcp energy config must be configured") + } + + if m.energyConfig.ValueSourceConsumption == nil { + return errors.New("value source consumption must be set") + } + + m.gridConsumption = measurements.AddDescription(model.MeasurementDescriptionDataType{ MeasurementType: util.Ptr(model.MeasurementTypeTypeEnergy), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), Unit: util.Ptr(model.UnitOfMeasurementTypeWh), ScopeType: util.Ptr(model.ScopeTypeTypeGridConsumption), }) + parameterDescription := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: m.gridConsumption, + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + }) + if parameterDescription == nil { + return errors.New("failed to add parameter description") + } + + if m.energyConfig.ValueConstraintsConsumption != nil { + m.energyConfig.ValueConstraintsConsumption.MeasurementId = m.gridConsumption + *measurementsConstraintData = append(*measurementsConstraintData, *m.energyConfig.ValueConstraintsConsumption) + } + + return nil +} + +func (m *MGCP) configureMonitorCurrent( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, +) error { + if m.currentConfig == nil { + return nil + } + + valueSourcesOfPhases := []*model.MeasurementValueSourceType{ + m.currentConfig.ValueSourcePhaseA, + m.currentConfig.ValueSourcePhaseB, + m.currentConfig.ValueSourcePhaseC, + } + + valueConstraints := []*model.MeasurementConstraintsDataType{ + m.currentConfig.ValueConstraintsPhaseA, + m.currentConfig.ValueConstraintsPhaseB, + m.currentConfig.ValueConstraintsPhaseC, + } + + electricalConnectedPhases := []model.ElectricalConnectionPhaseNameType{ + model.ElectricalConnectionPhaseNameTypeA, + model.ElectricalConnectionPhaseNameTypeB, + model.ElectricalConnectionPhaseNameTypeC, + } + for i := 0; i < len(m.acCurrent); i++ { - m.acCurrent[i] = measurement.AddDescription(model.MeasurementDescriptionDataType{ + if valueSourcesOfPhases[i] == nil { + continue + } + + m.acCurrent[i] = measurements.AddDescription(model.MeasurementDescriptionDataType{ MeasurementType: util.Ptr(model.MeasurementTypeTypeCurrent), CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), Unit: util.Ptr(model.UnitOfMeasurementTypeA), ScopeType: util.Ptr(model.ScopeTypeTypeACCurrent), }) - } - for i := 0; i < len(m.acVoltage); i++ { - m.acVoltage[i] = measurement.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeV), - ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + parameterDescription := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: m.acCurrent[i], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(electricalConnectedPhases[i]), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), }) + + if parameterDescription == nil { + return errors.New("failed to add parameter description") + } + + if valueConstraints[i] != nil { + valueConstraints[i].MeasurementId = m.acCurrent[i] + *measurementsConstraintData = append(*measurementsConstraintData, *valueConstraints[i]) + } } - m.acFrequency = measurement.AddDescription(model.MeasurementDescriptionDataType{ - MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), - CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), - Unit: util.Ptr(model.UnitOfMeasurementTypeHz), - ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), - }) + return nil +} - if m.acPowerTotal == nil || m.gridFeedIn == nil || m.gridConsumption == nil || m.acCurrent[0] == nil || m.acCurrent[1] == nil || m.acCurrent[2] == nil || - m.acVoltage[0] == nil || m.acVoltage[1] == nil || m.acVoltage[2] == nil || m.acFrequency == nil { - panic("failed to add measurement description") +func (m *MGCP) configureMonitorVoltage( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, +) error { + if m.voltageConfig == nil { + return nil } - electricalConnection, err := server.NewElectricalConnection(m.LocalEntity) - if err != nil { - panic(err) + electricalConnectionPhaseToPhase := [][]model.ElectricalConnectionPhaseNameType{ + {model.ElectricalConnectionPhaseNameTypeA, model.ElectricalConnectionPhaseNameTypeNeutral}, + {model.ElectricalConnectionPhaseNameTypeB, model.ElectricalConnectionPhaseNameTypeNeutral}, + {model.ElectricalConnectionPhaseNameTypeC, model.ElectricalConnectionPhaseNameTypeNeutral}, + {model.ElectricalConnectionPhaseNameTypeA, model.ElectricalConnectionPhaseNameTypeB}, + {model.ElectricalConnectionPhaseNameTypeB, model.ElectricalConnectionPhaseNameTypeC}, + {model.ElectricalConnectionPhaseNameTypeC, model.ElectricalConnectionPhaseNameTypeA}, } - idEc1 := model.ElectricalConnectionIdType(0) - err = electricalConnection.AddDescription(model.ElectricalConnectionDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - PowerSupplyType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - PositiveEnergyDirection: util.Ptr(model.EnergyDirectionTypeConsume), - }) - if err != nil { - panic(err) + valueSourcesOfPhases := []*model.MeasurementValueSourceType{ + m.voltageConfig.ValueSourcePhaseA, + m.voltageConfig.ValueSourcePhaseB, + m.voltageConfig.ValueSourcePhaseC, + m.voltageConfig.ValueSourcePhaseAToB, + m.voltageConfig.ValueSourcePhaseBToC, + m.voltageConfig.ValueSourcePhaseCToA, } - idP1 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: m.acPowerTotal, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeAbc), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - }) + valueConstraintsOfPhases := []*model.MeasurementConstraintsDataType{ + m.voltageConfig.ValueConstraintsPhaseA, + m.voltageConfig.ValueConstraintsPhaseB, + m.voltageConfig.ValueConstraintsPhaseC, + m.voltageConfig.ValueConstraintsPhaseAToB, + m.voltageConfig.ValueConstraintsPhaseBToC, + m.voltageConfig.ValueConstraintsPhaseCToA, + } - idP2 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: m.gridFeedIn, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - }) + for i := 0; i < len(m.acVoltage); i++ { + if valueSourcesOfPhases[i] == nil { + continue + } - idP3 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: m.gridConsumption, - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - }) + m.acVoltage[i] = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeVoltage), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeV), + ScopeType: util.Ptr(model.ScopeTypeTypeACVoltage), + }) - idP41 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: m.acCurrent[0], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - }) + parameterDescription := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, + MeasurementId: m.acVoltage[i], + VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), + AcMeasuredPhases: util.Ptr(electricalConnectionPhaseToPhase[i][0]), + AcMeasuredInReferenceTo: util.Ptr(electricalConnectionPhaseToPhase[i][1]), + AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), + AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + }) - idP42 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: m.acCurrent[1], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - }) + if parameterDescription == nil { + return errors.New("failed to add parameter description") + } - idP43 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: m.acCurrent[2], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeReal), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - }) + if valueConstraintsOfPhases[i] != nil { + valueConstraintsOfPhases[i].MeasurementId = m.acVoltage[i] + *measurementsConstraintData = append(*measurementsConstraintData, *valueConstraintsOfPhases[i]) + } + } - idP51 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: m.acVoltage[0], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeA), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - }) + return nil +} - idP52 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: m.acVoltage[1], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeB), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), - }) +func (m *MGCP) configureMonitorFrequency( + measurements *server.Measurement, + electricalConnection *server.ElectricalConnection, + electricalConnectionId *model.ElectricalConnectionIdType, + measurementsConstraintData *[]model.MeasurementConstraintsDataType, +) error { + if m.frequencyConfig == nil { + return nil + } - idP53 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), - MeasurementId: m.acVoltage[2], - VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), - AcMeasuredPhases: util.Ptr(model.ElectricalConnectionPhaseNameTypeC), - AcMeasuredInReferenceTo: util.Ptr(model.ElectricalConnectionPhaseNameTypeNeutral), - AcMeasurementType: util.Ptr(model.ElectricalConnectionAcMeasurementTypeTypeApparent), - AcMeasurementVariant: util.Ptr(model.ElectricalConnectionMeasurandVariantTypeRms), + m.acFrequency = measurements.AddDescription(model.MeasurementDescriptionDataType{ + MeasurementType: util.Ptr(model.MeasurementTypeTypeFrequency), + CommodityType: util.Ptr(model.CommodityTypeTypeElectricity), + Unit: util.Ptr(model.UnitOfMeasurementTypeHz), + ScopeType: util.Ptr(model.ScopeTypeTypeACFrequency), }) - idP6 := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ - ElectricalConnectionId: util.Ptr(idEc1), + parameterDescription := electricalConnection.AddParameterDescription(model.ElectricalConnectionParameterDescriptionDataType{ + ElectricalConnectionId: electricalConnectionId, MeasurementId: m.acFrequency, VoltageType: util.Ptr(model.ElectricalConnectionVoltageTypeTypeAc), }) + if parameterDescription == nil { + return errors.New("failed to add parameter description") + } - if idP1 == nil || idP2 == nil || idP3 == nil || idP41 == nil || idP42 == nil || idP43 == nil || idP51 == nil || - idP52 == nil || idP53 == nil || idP6 == nil { - panic("failed to add electrical connection parameter description") + if m.frequencyConfig.ValueConstraints != nil { + m.frequencyConfig.ValueConstraints.MeasurementId = m.acFrequency + *measurementsConstraintData = append(*measurementsConstraintData, *m.frequencyConfig.ValueConstraints) } + + return nil } func (m *MGCP) getMeasurementDataForId(id *model.MeasurementIdType) (float64, error) { diff --git a/usecases/gcp/mgcp/usecase_test.go b/usecases/gcp/mgcp/usecase_test.go new file mode 100644 index 00000000..f733a337 --- /dev/null +++ b/usecases/gcp/mgcp/usecase_test.go @@ -0,0 +1,165 @@ +package mgcp + +import ( + "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/mocks" + "github.com/enbility/eebus-go/service" + shipapi "github.com/enbility/ship-go/api" + "github.com/enbility/ship-go/cert" + spineapi "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/util" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/suite" + "testing" + "time" +) + +func TestMGCPUsecaseSuite(t *testing.T) { + suite.Run(t, new(MgcpUsecaseSuite)) +} + +type MgcpUsecaseSuite struct { + suite.Suite + + service api.ServiceInterface +} + +func (s *MgcpUsecaseSuite) BeforeTest(_, _ string) { + cert, _ := cert.CreateCertificate("test", "test", "DE", "test") + configuration, _ := api.NewConfiguration( + "test", "test", "test", "test", + []shipapi.DeviceCategoryType{shipapi.DeviceCategoryTypeEnergyManagementSystem}, + model.DeviceTypeTypeEnergyManagementSystem, + []model.EntityTypeType{model.EntityTypeTypeInverter}, + 9999, cert, time.Second*4) + + serviceHandler := mocks.NewServiceReaderInterface(s.T()) + serviceHandler.EXPECT().ServicePairingDetailUpdate(mock.Anything, mock.Anything).Return().Maybe() + + s.service = service.NewService(configuration, serviceHandler) + _ = s.service.Setup() +} + +func (s *MgcpUsecaseSuite) Test_RequiredParameters() { + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeEVSE) + + var monitorPowerConfig = MonitorPowerConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + var monitorEnergyConfig = MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + } + + numRequiredParams := 2 + + // iterate over all possible combinations of the required parameters that should not work + for i := 0; i < (1< Date: Thu, 28 Nov 2024 14:47:21 +0100 Subject: [PATCH 53/61] only add scenarios if configured --- usecases/gcp/mgcp/usecase.go | 74 +++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index 3087b141..661bbb73 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -65,60 +65,74 @@ func NewMGCP( } validActorTypes := []model.UseCaseActorType{model.UseCaseActorTypeGridConnectionPoint} - useCaseScenarios := []api.UseCaseScenario{ - { + useCaseScenarios := make([]api.UseCaseScenario, 0) + + if monitorFeedInLimitationConfig != nil { + useCaseScenarios = append(useCaseScenarios, api.UseCaseScenario{ Scenario: model.UseCaseScenarioSupportType(1), Mandatory: false, ServerFeatures: []model.FeatureTypeType{model.FeatureTypeTypeDeviceConfiguration}, + }) + } + + useCaseScenarios = append(useCaseScenarios, api.UseCaseScenario{ + Scenario: model.UseCaseScenarioSupportType(2), + Mandatory: true, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeMeasurement, + model.FeatureTypeTypeElectricalConnection, }, - { - Scenario: model.UseCaseScenarioSupportType(2), - Mandatory: true, - ServerFeatures: []model.FeatureTypeType{ - model.FeatureTypeTypeMeasurement, - model.FeatureTypeTypeElectricalConnection, - }, - }, - { - Scenario: model.UseCaseScenarioSupportType(3), - Mandatory: true, - ServerFeatures: []model.FeatureTypeType{ - model.FeatureTypeTypeMeasurement, - model.FeatureTypeTypeElectricalConnection, - }, + }) + + useCaseScenarios = append(useCaseScenarios, api.UseCaseScenario{ + Scenario: model.UseCaseScenarioSupportType(3), + Mandatory: true, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeMeasurement, + model.FeatureTypeTypeElectricalConnection, }, - { - Scenario: model.UseCaseScenarioSupportType(4), - Mandatory: true, - ServerFeatures: []model.FeatureTypeType{ - model.FeatureTypeTypeMeasurement, - model.FeatureTypeTypeElectricalConnection, - }, + }) + + useCaseScenarios = append(useCaseScenarios, api.UseCaseScenario{ + Scenario: model.UseCaseScenarioSupportType(4), + Mandatory: false, + ServerFeatures: []model.FeatureTypeType{ + model.FeatureTypeTypeMeasurement, + model.FeatureTypeTypeElectricalConnection, }, - { + }) + + if monitorCurrentConfig != nil { + useCaseScenarios = append(useCaseScenarios, api.UseCaseScenario{ Scenario: model.UseCaseScenarioSupportType(5), Mandatory: false, ServerFeatures: []model.FeatureTypeType{ model.FeatureTypeTypeMeasurement, model.FeatureTypeTypeElectricalConnection, }, - }, - { + }) + } + + if monitorVoltageConfig != nil { + useCaseScenarios = append(useCaseScenarios, api.UseCaseScenario{ Scenario: model.UseCaseScenarioSupportType(6), Mandatory: false, ServerFeatures: []model.FeatureTypeType{ model.FeatureTypeTypeMeasurement, model.FeatureTypeTypeElectricalConnection, }, - }, - { + }) + } + + if monitorFrequencyConfig != nil { + useCaseScenarios = append(useCaseScenarios, api.UseCaseScenario{ Scenario: model.UseCaseScenarioSupportType(7), Mandatory: false, ServerFeatures: []model.FeatureTypeType{ model.FeatureTypeTypeMeasurement, model.FeatureTypeTypeElectricalConnection, }, - }, + }) } usecase := usecase.NewUseCaseBase( From c9514391f9872617bc20845e67a1a5fec53c3c01 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 11 Dec 2024 09:52:18 +0100 Subject: [PATCH 54/61] Use the UpdateData from the usecases.api --- usecases/api/api.go | 10 ++++ usecases/api/gcp_mgcp.go | 43 ++++++--------- usecases/gcp/mgcp/public.go | 87 +++++++++++++++++------------- usecases/gcp/mgcp/update_helper.go | 60 +++++++++++++-------- 4 files changed, 113 insertions(+), 87 deletions(-) diff --git a/usecases/api/api.go b/usecases/api/api.go index 4bbeb772..3452e50a 100644 --- a/usecases/api/api.go +++ b/usecases/api/api.go @@ -32,3 +32,13 @@ type UpdateMeasurementData interface { UpdateData MeasurementData() api.MeasurementDataForID } + +// used to enable batch data updates for ConfigurationData +// +// usecases can use this interface to provide batch update capabilities by +// implementing a method that takes a list of this interface and updates the +// configuration data +type UpdateConfigurationData interface { + UpdateData + ConfigurationData() model.DeviceConfigurationKeyValueDataType +} diff --git a/usecases/api/gcp_mgcp.go b/usecases/api/gcp_mgcp.go index 6a75c665..e471cea3 100644 --- a/usecases/api/gcp_mgcp.go +++ b/usecases/api/gcp_mgcp.go @@ -94,12 +94,12 @@ type GcpMGCPInterface interface { // possible errors: // - ErrMissingData if the id is not available // - and others - Update(updateValueTypes ...GcpMGCPUpdateValueTypeInterface) error + Update(updateValueTypes ...UpdateData) error // Scenario 1 // Use UpdateDataPowerLimitationFactor in Update to set the current power limitation factor - UpdateDataPowerLimitationFactor(value float64) GcpMGCPUpdateValueTypeInterface + UpdateDataPowerLimitationFactor(value float64) UpdateData // Scenario 2 @@ -110,7 +110,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Scenario 3 @@ -124,7 +124,7 @@ type GcpMGCPInterface interface { valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Scenario 4 @@ -138,7 +138,7 @@ type GcpMGCPInterface interface { valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Scenario 5 @@ -149,7 +149,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Use UpdateDataCurrentPhaseB in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil @@ -158,7 +158,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Use UpdateDataCurrentPhaseC in Update to set the momentary phase specific current consumption or production // The timestamp is optional and can be nil @@ -167,7 +167,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Scenario 6 @@ -178,7 +178,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Use UpdateDataVoltagePhaseB in Update to set the phase specific voltage details // The timestamp is optional and can be nil @@ -187,7 +187,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Use UpdateDataVoltagePhaseC in Update to set the phase specific voltage details // The timestamp is optional and can be nil @@ -196,7 +196,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Use UpdateDataVoltagePhaseAToB in Update to set the phase specific voltage details // The timestamp is optional and can be nil @@ -205,7 +205,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Use UpdateDataVoltagePhaseBToC in Update to set the phase specific voltage details // The timestamp is optional and can be nil @@ -214,7 +214,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Use UpdateDataVoltagePhaseCToA in Update to set the phase specific voltage details // The timestamp is optional and can be nil @@ -223,7 +223,7 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) GcpMGCPUpdateValueTypeInterface + ) UpdateData // Scenario 7 @@ -234,18 +234,5 @@ type GcpMGCPInterface interface { value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, - ) GcpMGCPUpdateValueTypeInterface -} - -type GcpMGCPUpdateValueTypeType int - -const ( - GcpMGCPUpdateValueTypeTypeMeasurement GcpMGCPUpdateValueTypeType = 0 - GcpMGCPUpdateValueTypeTypeConfiguration GcpMGCPUpdateValueTypeType = 1 -) - -type GcpMGCPUpdateValueTypeInterface interface { - GetUpdateValueTypeType() GcpMGCPUpdateValueTypeType - GetUpdateValueTypeMeasurement() api.MeasurementDataForID - GetUpdateValueTypeConfiguration() model.DeviceConfigurationKeyValueDataType + ) UpdateData } diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go index 95c0f041..e0053614 100644 --- a/usecases/gcp/mgcp/public.go +++ b/usecases/gcp/mgcp/public.go @@ -147,18 +147,20 @@ func (m *MGCP) Frequency() (float64, error) { // possible errors: // - ErrMissingData if the id is not available // - and others -func (m *MGCP) Update(updateValueType ...usecaseapi.GcpMGCPUpdateValueTypeInterface) error { +func (m *MGCP) Update(updateValueType ...usecaseapi.UpdateData) error { measurements := make([]api.MeasurementDataForID, 0) configurations := make([]model.DeviceConfigurationKeyValueDataType, 0) for _, update := range updateValueType { - updateValueTypeType := update.GetUpdateValueTypeType() - if updateValueTypeType == usecaseapi.GcpMGCPUpdateValueTypeTypeMeasurement { - measurements = append(measurements, update.GetUpdateValueTypeMeasurement()) - } else if updateValueTypeType == usecaseapi.GcpMGCPUpdateValueTypeTypeConfiguration { - configurations = append(configurations, update.GetUpdateValueTypeConfiguration()) - } else { - return errors.New("unknown UpdateValueTypeType: " + string(rune(updateValueTypeType))) + switch update.(type) { + case usecaseapi.UpdateMeasurementData: + measurements = append(measurements, update.(usecaseapi.UpdateMeasurementData).MeasurementData()) + break + case usecaseapi.UpdateConfigurationData: + configurations = append(configurations, update.(usecaseapi.UpdateConfigurationData).ConfigurationData()) + break + default: + return errors.New("unsupported updateValueType") } } @@ -196,10 +198,19 @@ func (m *MGCP) Update(updateValueType ...usecaseapi.GcpMGCPUpdateValueTypeInterf // Scenario 1 // Use MGCP.UpdateDataPowerLimitationFactor in MGCP.Update to set the current power limitation factor -func (m *MGCP) UpdateDataPowerLimitationFactor(pvFeedInLimitationFactor float64) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return UpdateValueType{ - updateValueTypeType: usecaseapi.GcpMGCPUpdateValueTypeTypeConfiguration, - updateTypeConfiguration: model.DeviceConfigurationKeyValueDataType{ +func (m *MGCP) UpdateDataPowerLimitationFactor(pvFeedInLimitationFactor float64) usecaseapi.UpdateData { + if m.pvFeedInLimitationFactor == nil { + return &UpdateData{ + supported: false, + notSupportedError: errors.New("id is nil: UpdateDataPowerLimitationFactor, please check the mgcp configuration"), + } + } + + return &UpdateConfigurationData{ + UpdateData: UpdateData{ + supported: true, + }, + configurationData: model.DeviceConfigurationKeyValueDataType{ KeyId: m.pvFeedInLimitationFactor, Value: &model.DeviceConfigurationKeyValueValueType{ ScaledNumber: model.NewScaledNumberType(pvFeedInLimitationFactor), @@ -217,8 +228,8 @@ func (m *MGCP) UpdateDataPowerTotal( acPowerTotal float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataPowerTotal", m.acPowerTotal, m.powerConfig.ValueSource, @@ -242,8 +253,8 @@ func (m *MGCP) UpdateDataEnergyFeedIn( valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataEnergyFeedIn", m.gridFeedIn, m.energyConfig.ValueSourceProduction, @@ -267,8 +278,8 @@ func (m *MGCP) UpdateDataEnergyConsumed( valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataEnergyConsumed", m.gridConsumption, m.energyConfig.ValueSourceConsumption, @@ -289,8 +300,8 @@ func (m *MGCP) UpdateDataCurrentPhaseA( current float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataCurrentPhaseA", m.acCurrent[0], m.currentConfig.ValueSourcePhaseA, @@ -309,8 +320,8 @@ func (m *MGCP) UpdateDataCurrentPhaseB( current float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataCurrentPhaseB", m.acCurrent[1], m.currentConfig.ValueSourcePhaseB, @@ -329,8 +340,8 @@ func (m *MGCP) UpdateDataCurrentPhaseC( current float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataCurrentPhaseC", m.acCurrent[2], m.currentConfig.ValueSourcePhaseC, @@ -351,8 +362,8 @@ func (m *MGCP) UpdateDataVoltagePhaseA( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataVoltagePhaseA", m.acVoltage[0], m.voltageConfig.ValueSourcePhaseA, @@ -371,8 +382,8 @@ func (m *MGCP) UpdateDataVoltagePhaseB( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataVoltagePhaseB", m.acVoltage[1], m.voltageConfig.ValueSourcePhaseB, @@ -391,8 +402,8 @@ func (m *MGCP) UpdateDataVoltagePhaseC( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataVoltagePhaseC", m.acVoltage[2], m.voltageConfig.ValueSourcePhaseC, @@ -411,8 +422,8 @@ func (m *MGCP) UpdateDataVoltagePhaseAToB( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataVoltagePhaseAToB", m.acVoltage[3], m.voltageConfig.ValueSourcePhaseAToB, @@ -431,8 +442,8 @@ func (m *MGCP) UpdateDataVoltagePhaseBToC( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataVoltagePhaseBToC", m.acVoltage[4], m.voltageConfig.ValueSourcePhaseBToC, @@ -451,8 +462,8 @@ func (m *MGCP) UpdateDataVoltagePhaseCToA( voltage float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataVoltagePhaseCToA", m.acVoltage[5], m.voltageConfig.ValueSourcePhaseCToA, @@ -473,8 +484,8 @@ func (m *MGCP) UpdateDataFrequency( frequency float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, -) usecaseapi.GcpMGCPUpdateValueTypeInterface { - return measurementUpdateValueType( +) usecaseapi.UpdateData { + return updateMeasurementData( "UpdateDataFrequency", m.acFrequency, m.frequencyConfig.ValueSource, diff --git a/usecases/gcp/mgcp/update_helper.go b/usecases/gcp/mgcp/update_helper.go index cf61c3fa..8f6a77af 100644 --- a/usecases/gcp/mgcp/update_helper.go +++ b/usecases/gcp/mgcp/update_helper.go @@ -9,27 +9,40 @@ import ( "time" ) -type UpdateValueType struct { - updateValueTypeType usecaseapi.GcpMGCPUpdateValueTypeType - updateTypeMeasurement api.MeasurementDataForID - updateTypeConfiguration model.DeviceConfigurationKeyValueDataType +type UpdateData struct { + supported bool + notSupportedError error } -func (u UpdateValueType) GetUpdateValueTypeType() usecaseapi.GcpMGCPUpdateValueTypeType { - return u.updateValueTypeType +type UpdateMeasurementData struct { + UpdateData + + measurementData api.MeasurementDataForID } -func (u UpdateValueType) GetUpdateValueTypeMeasurement() api.MeasurementDataForID { - return u.updateTypeMeasurement +type UpdateConfigurationData struct { + UpdateData + + configurationData model.DeviceConfigurationKeyValueDataType } -func (u UpdateValueType) GetUpdateValueTypeConfiguration() model.DeviceConfigurationKeyValueDataType { - return u.updateTypeConfiguration +func (u *UpdateData) Supported() bool { + return u.supported } -var _ usecaseapi.GcpMGCPUpdateValueTypeInterface = (*UpdateValueType)(nil) +func (u *UpdateData) NotSupportedError() error { + return u.notSupportedError +} + +func (u *UpdateMeasurementData) MeasurementData() api.MeasurementDataForID { + return u.measurementData +} -func measurementUpdateValueType( +func (u UpdateConfigurationData) ConfigurationData() model.DeviceConfigurationKeyValueDataType { + return u.configurationData +} + +func updateMeasurementData( errorName string, id *model.MeasurementIdType, valueSource *model.MeasurementValueSourceType, @@ -38,14 +51,19 @@ func measurementUpdateValueType( valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time, -) UpdateValueType { +) usecaseapi.UpdateData { if id == nil { - panic(fmt.Sprintf("%s is not supported by the use case MGCP, please check the MGCP configuration", errorName)) + return &UpdateData{ + supported: false, + notSupportedError: fmt.Errorf("id is nil: %s, please check the mgcp configuration", errorName), + } } - updateValueType := UpdateValueType{ - updateValueTypeType: usecaseapi.GcpMGCPUpdateValueTypeTypeMeasurement, - updateTypeMeasurement: api.MeasurementDataForID{ + updateValueType := UpdateMeasurementData{ + UpdateData: UpdateData{ + supported: true, + }, + measurementData: api.MeasurementDataForID{ Id: *id, Data: model.MeasurementDataType{ ValueType: util.Ptr(model.MeasurementValueTypeTypeValue), @@ -56,19 +74,19 @@ func measurementUpdateValueType( } if timestamp != nil { - updateValueType.updateTypeMeasurement.Data.Timestamp = model.NewAbsoluteOrRelativeTimeTypeFromTime(*timestamp) + updateValueType.measurementData.Data.Timestamp = model.NewAbsoluteOrRelativeTimeTypeFromTime(*timestamp) } if valueState != nil { - updateValueType.updateTypeMeasurement.Data.ValueState = valueState + updateValueType.measurementData.Data.ValueState = valueState } if evaluationStart != nil && evaluationEnd != nil { - updateValueType.updateTypeMeasurement.Data.EvaluationPeriod = &model.TimePeriodType{ + updateValueType.measurementData.Data.EvaluationPeriod = &model.TimePeriodType{ StartTime: model.NewAbsoluteOrRelativeTimeTypeFromTime(*evaluationStart), EndTime: model.NewAbsoluteOrRelativeTimeTypeFromTime(*evaluationEnd), } } - return updateValueType + return &updateValueType } From 632471399f7269f0062878fdd2cbcb1ba143da95 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Wed, 11 Dec 2024 11:04:10 +0100 Subject: [PATCH 55/61] Add test for getMeasurementForId and use the GridGuardEntityType --- usecases/gcp/mgcp/usecase_test.go | 54 ++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/usecases/gcp/mgcp/usecase_test.go b/usecases/gcp/mgcp/usecase_test.go index f733a337..19ce3dad 100644 --- a/usecases/gcp/mgcp/usecase_test.go +++ b/usecases/gcp/mgcp/usecase_test.go @@ -32,7 +32,7 @@ func (s *MgcpUsecaseSuite) BeforeTest(_, _ string) { "test", "test", "test", "test", []shipapi.DeviceCategoryType{shipapi.DeviceCategoryTypeEnergyManagementSystem}, model.DeviceTypeTypeEnergyManagementSystem, - []model.EntityTypeType{model.EntityTypeTypeInverter}, + []model.EntityTypeType{model.EntityTypeTypeGridGuard}, 9999, cert, time.Second*4) serviceHandler := mocks.NewServiceReaderInterface(s.T()) @@ -43,7 +43,7 @@ func (s *MgcpUsecaseSuite) BeforeTest(_, _ string) { } func (s *MgcpUsecaseSuite) Test_RequiredParameters() { - localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeEVSE) + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard) var monitorPowerConfig = MonitorPowerConfig{ ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), @@ -60,7 +60,6 @@ func (s *MgcpUsecaseSuite) Test_RequiredParameters() { for i := 0; i < (1< Date: Fri, 13 Dec 2024 09:52:49 +0100 Subject: [PATCH 56/61] refactoring --- usecases/gcp/mgcp/usecase_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usecases/gcp/mgcp/usecase_test.go b/usecases/gcp/mgcp/usecase_test.go index 19ce3dad..fc62dc17 100644 --- a/usecases/gcp/mgcp/usecase_test.go +++ b/usecases/gcp/mgcp/usecase_test.go @@ -42,6 +42,9 @@ func (s *MgcpUsecaseSuite) BeforeTest(_, _ string) { _ = s.service.Setup() } +func (s *MgcpUsecaseSuite) Event(_ string, _ spineapi.DeviceRemoteInterface, _ spineapi.EntityRemoteInterface, _ api.EventType) { +} + func (s *MgcpUsecaseSuite) Test_RequiredParameters() { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard) @@ -204,6 +207,3 @@ func (s *MgcpUsecaseSuite) Test_getMeasurementForId() { assert.Nil(s.T(), err) assert.Equal(s.T(), value, m) } - -func (s *MgcpUsecaseSuite) Event(_ string, _ spineapi.DeviceRemoteInterface, _ spineapi.EntityRemoteInterface, _ api.EventType) { -} From 551d63ad6b2b246251f45bea43b27aeacb0d9684 Mon Sep 17 00:00:00 2001 From: Nils Prommersberger Date: Fri, 13 Dec 2024 11:24:54 +0100 Subject: [PATCH 57/61] error coverage for usecase --- usecases/gcp/mgcp/usecase.go | 30 +- usecases/gcp/mgcp/usecase_test.go | 476 ++++++++++++++++++++++++++++++ 2 files changed, 491 insertions(+), 15 deletions(-) diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index 661bbb73..706ecfa4 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -212,8 +212,8 @@ func (m *MGCP) AddFeatures() error { constraints := make([]model.MeasurementConstraintsDataType, 0) configMethods := []func( - measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + measurements api.MeasurementServerInterface, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error{ @@ -244,7 +244,7 @@ func (m *MGCP) AddFeatures() error { } func (m *MGCP) configurePvFeedInLimitationFactor( - configurations *server.DeviceConfiguration, + configurations api.DeviceConfigurationServerInterface, ) error { if m.limitationConfig == nil { return nil @@ -264,8 +264,8 @@ func (m *MGCP) configurePvFeedInLimitationFactor( } func (m *MGCP) configureMonitorPower( - measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + measurements api.MeasurementServerInterface, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { @@ -307,8 +307,8 @@ func (m *MGCP) configureMonitorPower( } func (m *MGCP) configureGridFeedIn( - measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + measurements api.MeasurementServerInterface, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { @@ -346,8 +346,8 @@ func (m *MGCP) configureGridFeedIn( } func (m *MGCP) configureGridConsumption( - measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + measurements api.MeasurementServerInterface, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { @@ -385,8 +385,8 @@ func (m *MGCP) configureGridConsumption( } func (m *MGCP) configureMonitorCurrent( - measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + measurements api.MeasurementServerInterface, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { @@ -447,8 +447,8 @@ func (m *MGCP) configureMonitorCurrent( } func (m *MGCP) configureMonitorVoltage( - measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + measurements api.MeasurementServerInterface, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { @@ -519,8 +519,8 @@ func (m *MGCP) configureMonitorVoltage( } func (m *MGCP) configureMonitorFrequency( - measurements *server.Measurement, - electricalConnection *server.ElectricalConnection, + measurements api.MeasurementServerInterface, + electricalConnection api.ElectricalConnectionServerInterface, electricalConnectionId *model.ElectricalConnectionIdType, measurementsConstraintData *[]model.MeasurementConstraintsDataType, ) error { diff --git a/usecases/gcp/mgcp/usecase_test.go b/usecases/gcp/mgcp/usecase_test.go index fc62dc17..c3bdefd3 100644 --- a/usecases/gcp/mgcp/usecase_test.go +++ b/usecases/gcp/mgcp/usecase_test.go @@ -7,6 +7,7 @@ import ( shipapi "github.com/enbility/ship-go/api" "github.com/enbility/ship-go/cert" spineapi "github.com/enbility/spine-go/api" + spinemocks "github.com/enbility/spine-go/mocks" "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/util" "github.com/stretchr/testify/assert" @@ -207,3 +208,478 @@ func (s *MgcpUsecaseSuite) Test_getMeasurementForId() { assert.Nil(s.T(), err) assert.Equal(s.T(), value, m) } + +func (s *GcpMpcgSuite) Test_AddFeaturesConfigurationNilError() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + s.sut.LocalEntity = localEntity + + anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().AddFunctionType(mock.Anything, mock.Anything, mock.Anything).Return() + localEntity.EXPECT().GetOrAddFeature(mock.Anything, mock.Anything).Return(anyFeature) + + localEntity.EXPECT().Device().Return(nil) + localEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeDeviceConfiguration, mock.Anything).Return(nil) + + err := s.sut.AddFeatures() + assert.NotNil(s.T(), err) // NewDeviceConfiguration failed +} + +func (s *GcpMpcgSuite) Test_AddFeaturesMeasurementNilError() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + s.sut.LocalEntity = localEntity + + anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil).Maybe() + anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + anyFeature.EXPECT().AddFunctionType(mock.Anything, mock.Anything, mock.Anything).Return() + localEntity.EXPECT().GetOrAddFeature(mock.Anything, mock.Anything).Return(anyFeature) + + localEntity.EXPECT().Device().Return(nil) + localEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeDeviceConfiguration, mock.Anything).Return(anyFeature) + localEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeMeasurement, mock.Anything).Return(nil) + + err := s.sut.AddFeatures() + assert.NotNil(s.T(), err) // NewMeasurement failed +} + +func (s *GcpMpcgSuite) Test_AddFeaturesElectricalConnectionNilError() { + localEntity := spinemocks.NewEntityLocalInterface(s.T()) + s.sut.LocalEntity = localEntity + + anyFeature := spinemocks.NewFeatureLocalInterface(s.T()) + anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil).Maybe() + anyFeature.EXPECT().UpdateData(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + anyFeature.EXPECT().AddFunctionType(mock.Anything, mock.Anything, mock.Anything).Return() + localEntity.EXPECT().GetOrAddFeature(mock.Anything, mock.Anything).Return(anyFeature) + + localEntity.EXPECT().Device().Return(nil) + localEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeDeviceConfiguration, mock.Anything).Return(anyFeature) + localEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeMeasurement, mock.Anything).Return(anyFeature) + localEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeElectricalConnection, mock.Anything).Return(nil) + + err := s.sut.AddFeatures() + assert.NotNil(s.T(), err) // NewMeasurement failed +} + +func (s *MgcpUsecaseSuite) Test_configurePvFeedInLimitationFactorError() { + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + + mgcp, err := NewMGCP( + localEntity, + s.Event, + &MonitorPvFeedInPowerLimitationFactorConfig{}, + &MonitorPowerConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + }, + &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorVoltageConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + ) + assert.Nil(s.T(), err) + + deviceConfiguration := mocks.NewDeviceConfigurationServerInterface(s.T()) + deviceConfiguration.EXPECT().AddKeyValueDescription(mock.Anything).Return(nil) + + err = mgcp.configurePvFeedInLimitationFactor(deviceConfiguration) + assert.NotNil(s.T(), err) +} + +func (s *MgcpUsecaseSuite) Test_configureMonitorPowerError() { + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + + mgcp, err := NewMGCP( + localEntity, + s.Event, + &MonitorPvFeedInPowerLimitationFactorConfig{}, + &MonitorPowerConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + }, + &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorVoltageConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + ) + assert.Nil(s.T(), err) + + measurements := mocks.NewMeasurementServerInterface(s.T()) + electricalConnection := mocks.NewElectricalConnectionServerInterface(s.T()) + electricalConnectionId := model.ElectricalConnectionIdType(0) + constraints := make([]model.MeasurementConstraintsDataType, 0) + + mgcp.powerConfig = nil + err = mgcp.configureMonitorPower(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) + + mgcp.powerConfig = &MonitorPowerConfig{ + ValueSource: nil, + } + err = mgcp.configureMonitorPower(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) + + mgcp.powerConfig = &MonitorPowerConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + } + + measurements.EXPECT().AddDescription(mock.Anything).Return(nil) + electricalConnection.EXPECT().AddParameterDescription(mock.Anything).Return(nil) + err = mgcp.configureMonitorPower(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) +} + +func (s *MgcpUsecaseSuite) Test_configureGridFeedInError() { + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + + mgcp, err := NewMGCP( + localEntity, + s.Event, + &MonitorPvFeedInPowerLimitationFactorConfig{}, + &MonitorPowerConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + }, + &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorVoltageConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + ) + assert.Nil(s.T(), err) + + measurements := mocks.NewMeasurementServerInterface(s.T()) + electricalConnection := mocks.NewElectricalConnectionServerInterface(s.T()) + electricalConnectionId := model.ElectricalConnectionIdType(0) + constraints := make([]model.MeasurementConstraintsDataType, 0) + + mgcp.energyConfig = nil + err = mgcp.configureGridFeedIn(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) + + mgcp.energyConfig = &MonitorEnergyConfig{ + ValueSourceProduction: nil, + } + err = mgcp.configureGridFeedIn(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) + + mgcp.energyConfig = &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + } + + measurements.EXPECT().AddDescription(mock.Anything).Return(nil) + electricalConnection.EXPECT().AddParameterDescription(mock.Anything).Return(nil) + err = mgcp.configureGridFeedIn(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) +} + +func (s *MgcpUsecaseSuite) Test_configureGridConsumptionError() { + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + + mgcp, err := NewMGCP( + localEntity, + s.Event, + &MonitorPvFeedInPowerLimitationFactorConfig{}, + &MonitorPowerConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + }, + &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorVoltageConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + ) + assert.Nil(s.T(), err) + + measurements := mocks.NewMeasurementServerInterface(s.T()) + electricalConnection := mocks.NewElectricalConnectionServerInterface(s.T()) + electricalConnectionId := model.ElectricalConnectionIdType(0) + constraints := make([]model.MeasurementConstraintsDataType, 0) + + mgcp.energyConfig = nil + err = mgcp.configureGridConsumption(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) + + mgcp.energyConfig = &MonitorEnergyConfig{ + ValueSourceConsumption: nil, + } + err = mgcp.configureGridConsumption(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) + + mgcp.energyConfig = &MonitorEnergyConfig{ + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + } + + measurements.EXPECT().AddDescription(mock.Anything).Return(nil) + electricalConnection.EXPECT().AddParameterDescription(mock.Anything).Return(nil) + err = mgcp.configureGridConsumption(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) +} + +func (s *MgcpUsecaseSuite) Test_configureMonitorCurrentError() { + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + + mgcp, err := NewMGCP( + localEntity, + s.Event, + &MonitorPvFeedInPowerLimitationFactorConfig{}, + &MonitorPowerConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + }, + &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorVoltageConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + ) + assert.Nil(s.T(), err) + + measurements := mocks.NewMeasurementServerInterface(s.T()) + electricalConnection := mocks.NewElectricalConnectionServerInterface(s.T()) + electricalConnectionId := model.ElectricalConnectionIdType(0) + constraints := make([]model.MeasurementConstraintsDataType, 0) + + measurements.EXPECT().AddDescription(mock.Anything).Return(nil) + electricalConnection.EXPECT().AddParameterDescription(mock.Anything).Return(nil) + + currentConfigurations := []MonitorCurrentConfig{ + { + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + { + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + { + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + } + + for _, currentConfig := range currentConfigurations { + mgcp.currentConfig = ¤tConfig + err = mgcp.configureMonitorCurrent(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) // failed to add parameter description + } +} + +func (s *MgcpUsecaseSuite) Test_configureMonitorVoltageError() { + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + + mgcp, err := NewMGCP( + localEntity, + s.Event, + &MonitorPvFeedInPowerLimitationFactorConfig{}, + &MonitorPowerConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + }, + &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorVoltageConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + ) + assert.Nil(s.T(), err) + + measurements := mocks.NewMeasurementServerInterface(s.T()) + electricalConnection := mocks.NewElectricalConnectionServerInterface(s.T()) + electricalConnectionId := model.ElectricalConnectionIdType(0) + constraints := make([]model.MeasurementConstraintsDataType, 0) + + measurements.EXPECT().AddDescription(mock.Anything).Return(nil) + electricalConnection.EXPECT().AddParameterDescription(mock.Anything).Return(nil) + + voltageConfigurations := []MonitorVoltageConfig{ + { + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + { + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + { + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + { + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + { + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + { + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + } + + for _, voltageConfig := range voltageConfigurations { + mgcp.voltageConfig = &voltageConfig + err = mgcp.configureMonitorVoltage(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) // failed to add parameter description + } +} + +func (s *MgcpUsecaseSuite) Test_configureMonitorFrequencyError() { + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + + mgcp, err := NewMGCP( + localEntity, + s.Event, + &MonitorPvFeedInPowerLimitationFactorConfig{}, + &MonitorPowerConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueConstraints: util.Ptr(model.MeasurementConstraintsDataType{ + ValueRangeMin: model.NewScaledNumberType(0), + ValueRangeMax: model.NewScaledNumberType(100), + ValueStepSize: model.NewScaledNumberType(1), + }), + }, + &MonitorEnergyConfig{ + ValueSourceProduction: util.Ptr(model.MeasurementValueSourceTypeCalculatedValue), + ValueSourceConsumption: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorCurrentConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorVoltageConfig{ + ValueSourcePhaseA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseAToB: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseBToC: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + ValueSourcePhaseCToA: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + &MonitorFrequencyConfig{ + ValueSource: util.Ptr(model.MeasurementValueSourceTypeMeasuredValue), + }, + ) + assert.Nil(s.T(), err) + + measurements := mocks.NewMeasurementServerInterface(s.T()) + electricalConnection := mocks.NewElectricalConnectionServerInterface(s.T()) + electricalConnectionId := model.ElectricalConnectionIdType(0) + constraints := make([]model.MeasurementConstraintsDataType, 0) + + measurements.EXPECT().AddDescription(mock.Anything).Return(nil) + electricalConnection.EXPECT().AddParameterDescription(mock.Anything).Return(nil) + + err = mgcp.configureMonitorFrequency(measurements, electricalConnection, &electricalConnectionId, &constraints) + assert.NotNil(s.T(), err) // failed to add parameter description +} From 97556df8d5787e189215bd3afab992a3de66e2db Mon Sep 17 00:00:00 2001 From: Tom Luca Roth Date: Fri, 29 May 2026 15:23:57 +0200 Subject: [PATCH 58/61] regenerated mocks --- mocks/DeviceClassificationClientInterface.go | 58 +- mocks/DeviceClassificationCommonInterface.go | 58 +- mocks/DeviceClassificationServerInterface.go | 34 +- mocks/DeviceConfigurationClientInterface.go | 318 ++-- mocks/DeviceConfigurationCommonInterface.go | 206 ++- mocks/DeviceConfigurationServerInterface.go | 301 ++-- mocks/DeviceDiagnosisClientInterface.go | 82 +- mocks/DeviceDiagnosisCommonInterface.go | 87 +- mocks/DeviceDiagnosisServerInterface.go | 68 +- mocks/ElectricalConnectionClientInterface.go | 190 ++- mocks/ElectricalConnectionCommonInterface.go | 354 ++-- mocks/ElectricalConnectionServerInterface.go | 565 ++++--- mocks/FeatureClientInterface.go | 171 +- mocks/FeatureServerInterface.go | 34 +- mocks/IdentificationClientInterface.go | 58 +- mocks/IdentificationCommonInterface.go | 97 +- mocks/IdentificationServerInterface.go | 34 +- mocks/IncentiveTableClientInterface.go | 174 +- mocks/IncentiveTableCommonInterface.go | 116 +- mocks/IncentiveTableServerInterface.go | 34 +- mocks/LoadControlClientInterface.go | 195 ++- mocks/LoadControlCommonInterface.go | 206 ++- mocks/LoadControlServerInterface.go | 122 +- mocks/MeasurementClientInterface.go | 151 +- mocks/MeasurementCommonInterface.go | 240 +-- mocks/MeasurementServerInterface.go | 122 +- mocks/ServiceInterface.go | 175 +- mocks/ServiceReaderInterface.go | 37 +- .../SmartEnergyManagementPsClientInterface.go | 92 +- .../SmartEnergyManagementPsCommonInterface.go | 58 +- .../SmartEnergyManagementPsServerInterface.go | 34 +- mocks/TimeSeriesClientInterface.go | 185 ++- mocks/TimeSeriesCommonInterface.go | 126 +- mocks/TimeSeriesServerInterface.go | 34 +- mocks/UseCaseBaseInterface.go | 181 +- mocks/UseCaseInterface.go | 196 ++- usecases/mocks/CemCEVCInterface.go | 589 ++++--- usecases/mocks/CemEVCCInterface.go | 517 +++--- usecases/mocks/CemEVCEMInterface.go | 348 ++-- usecases/mocks/CemEVSECCInterface.go | 285 ++-- usecases/mocks/CemEVSOCInterface.go | 234 +-- usecases/mocks/CemOPEVInterface.go | 379 +++-- usecases/mocks/CemOSCEVInterface.go | 379 +++-- usecases/mocks/CemVABDInterface.go | 348 ++-- usecases/mocks/CemVAPDInterface.go | 310 ++-- usecases/mocks/CsLPCInterface.go | 577 ++++--- usecases/mocks/CsLPPInterface.go | 577 ++++--- usecases/mocks/EgLPCInterface.go | 535 +++--- usecases/mocks/EgLPPInterface.go | 535 +++--- usecases/mocks/GcpMGCPInterface.go | 1478 ++++++++++++++--- usecases/mocks/MaMGCPInterface.go | 462 +++--- usecases/mocks/MaMPCInterface.go | 462 +++--- usecases/mocks/MuMPCInterface.go | 1057 +++++++----- usecases/mocks/UpdateConfigurationData.go | 169 ++ usecases/mocks/UpdateData.go | 66 +- usecases/mocks/UpdateMeasurementData.go | 79 +- usecases/mu/mpc/testhelper_test.go | 2 +- usecases/mu/mpc/usecase.go | 3 +- usecases/mu/mpc/usecase_test.go | 2 +- 59 files changed, 8884 insertions(+), 5702 deletions(-) create mode 100644 usecases/mocks/UpdateConfigurationData.go diff --git a/mocks/DeviceClassificationClientInterface.go b/mocks/DeviceClassificationClientInterface.go index 65148766..76bcffae 100644 --- a/mocks/DeviceClassificationClientInterface.go +++ b/mocks/DeviceClassificationClientInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewDeviceClassificationClientInterface creates a new instance of DeviceClassificationClientInterface. 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 NewDeviceClassificationClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceClassificationClientInterface { + mock := &DeviceClassificationClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // DeviceClassificationClientInterface is an autogenerated mock type for the DeviceClassificationClientInterface type type DeviceClassificationClientInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *DeviceClassificationClientInterface) EXPECT() *DeviceClassificationCli return &DeviceClassificationClientInterface_Expecter{mock: &_m.Mock} } -// RequestManufacturerDetails provides a mock function with no fields -func (_m *DeviceClassificationClientInterface) RequestManufacturerDetails() (*model.MsgCounterType, error) { - ret := _m.Called() +// RequestManufacturerDetails provides a mock function for the type DeviceClassificationClientInterface +func (_mock *DeviceClassificationClientInterface) RequestManufacturerDetails() (*model.MsgCounterType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RequestManufacturerDetails") @@ -30,23 +46,21 @@ func (_m *DeviceClassificationClientInterface) RequestManufacturerDetails() (*mo var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -67,8 +81,8 @@ func (_c *DeviceClassificationClientInterface_RequestManufacturerDetails_Call) R return _c } -func (_c *DeviceClassificationClientInterface_RequestManufacturerDetails_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceClassificationClientInterface_RequestManufacturerDetails_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceClassificationClientInterface_RequestManufacturerDetails_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceClassificationClientInterface_RequestManufacturerDetails_Call { + _c.Call.Return(msgCounterType, err) return _c } @@ -76,17 +90,3 @@ func (_c *DeviceClassificationClientInterface_RequestManufacturerDetails_Call) R _c.Call.Return(run) return _c } - -// NewDeviceClassificationClientInterface creates a new instance of DeviceClassificationClientInterface. 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 NewDeviceClassificationClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceClassificationClientInterface { - mock := &DeviceClassificationClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/DeviceClassificationCommonInterface.go b/mocks/DeviceClassificationCommonInterface.go index cd265b04..41d3e52d 100644 --- a/mocks/DeviceClassificationCommonInterface.go +++ b/mocks/DeviceClassificationCommonInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewDeviceClassificationCommonInterface creates a new instance of DeviceClassificationCommonInterface. 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 NewDeviceClassificationCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceClassificationCommonInterface { + mock := &DeviceClassificationCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // DeviceClassificationCommonInterface is an autogenerated mock type for the DeviceClassificationCommonInterface type type DeviceClassificationCommonInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *DeviceClassificationCommonInterface) EXPECT() *DeviceClassificationCom return &DeviceClassificationCommonInterface_Expecter{mock: &_m.Mock} } -// GetManufacturerDetails provides a mock function with no fields -func (_m *DeviceClassificationCommonInterface) GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error) { - ret := _m.Called() +// GetManufacturerDetails provides a mock function for the type DeviceClassificationCommonInterface +func (_mock *DeviceClassificationCommonInterface) GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for GetManufacturerDetails") @@ -30,23 +46,21 @@ func (_m *DeviceClassificationCommonInterface) GetManufacturerDetails() (*model. var r0 *model.DeviceClassificationManufacturerDataType var r1 error - if rf, ok := ret.Get(0).(func() (*model.DeviceClassificationManufacturerDataType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.DeviceClassificationManufacturerDataType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.DeviceClassificationManufacturerDataType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.DeviceClassificationManufacturerDataType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceClassificationManufacturerDataType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -67,8 +81,8 @@ func (_c *DeviceClassificationCommonInterface_GetManufacturerDetails_Call) Run(r return _c } -func (_c *DeviceClassificationCommonInterface_GetManufacturerDetails_Call) Return(_a0 *model.DeviceClassificationManufacturerDataType, _a1 error) *DeviceClassificationCommonInterface_GetManufacturerDetails_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceClassificationCommonInterface_GetManufacturerDetails_Call) Return(deviceClassificationManufacturerDataType *model.DeviceClassificationManufacturerDataType, err error) *DeviceClassificationCommonInterface_GetManufacturerDetails_Call { + _c.Call.Return(deviceClassificationManufacturerDataType, err) return _c } @@ -76,17 +90,3 @@ func (_c *DeviceClassificationCommonInterface_GetManufacturerDetails_Call) RunAn _c.Call.Return(run) return _c } - -// NewDeviceClassificationCommonInterface creates a new instance of DeviceClassificationCommonInterface. 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 NewDeviceClassificationCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceClassificationCommonInterface { - mock := &DeviceClassificationCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/DeviceClassificationServerInterface.go b/mocks/DeviceClassificationServerInterface.go index f62c6fd1..5c732083 100644 --- a/mocks/DeviceClassificationServerInterface.go +++ b/mocks/DeviceClassificationServerInterface.go @@ -1,21 +1,12 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks -import mock "github.com/stretchr/testify/mock" - -// DeviceClassificationServerInterface is an autogenerated mock type for the DeviceClassificationServerInterface type -type DeviceClassificationServerInterface struct { - mock.Mock -} - -type DeviceClassificationServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *DeviceClassificationServerInterface) EXPECT() *DeviceClassificationServerInterface_Expecter { - return &DeviceClassificationServerInterface_Expecter{mock: &_m.Mock} -} +import ( + mock "github.com/stretchr/testify/mock" +) // NewDeviceClassificationServerInterface creates a new instance of DeviceClassificationServerInterface. 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. @@ -30,3 +21,16 @@ func NewDeviceClassificationServerInterface(t interface { return mock } + +// DeviceClassificationServerInterface is an autogenerated mock type for the DeviceClassificationServerInterface type +type DeviceClassificationServerInterface struct { + mock.Mock +} + +type DeviceClassificationServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *DeviceClassificationServerInterface) EXPECT() *DeviceClassificationServerInterface_Expecter { + return &DeviceClassificationServerInterface_Expecter{mock: &_m.Mock} +} diff --git a/mocks/DeviceConfigurationClientInterface.go b/mocks/DeviceConfigurationClientInterface.go index cd0b6ef3..1d196160 100644 --- a/mocks/DeviceConfigurationClientInterface.go +++ b/mocks/DeviceConfigurationClientInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewDeviceConfigurationClientInterface creates a new instance of DeviceConfigurationClientInterface. 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 NewDeviceConfigurationClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceConfigurationClientInterface { + mock := &DeviceConfigurationClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // DeviceConfigurationClientInterface is an autogenerated mock type for the DeviceConfigurationClientInterface type type DeviceConfigurationClientInterface struct { mock.Mock @@ -20,21 +36,20 @@ func (_m *DeviceConfigurationClientInterface) EXPECT() *DeviceConfigurationClien return &DeviceConfigurationClientInterface_Expecter{mock: &_m.Mock} } -// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter -func (_m *DeviceConfigurationClientInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { - ret := _m.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function for the type DeviceConfigurationClientInterface +func (_mock *DeviceConfigurationClientInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { + ret := _mock.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { - r0 = rf(payloadData, filter) + if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { + r0 = returnFunc(payloadData, filter) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -44,32 +59,43 @@ type DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call stru } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData interface{} -// - filter interface{} +// - payloadData any +// - filter any func (_e *DeviceConfigurationClientInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { return &DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(interface{}), args[1].(interface{})) + var arg0 any + if args[0] != nil { + arg0 = args[0].(any) + } + var arg1 any + if args[1] != nil { + arg1 = args[1].(any) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(_a0) +func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(b) return _c } -func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForFilter provides a mock function with given fields: filter -func (_m *DeviceConfigurationClientInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _m.Called(filter) +// GetKeyValueDataForFilter provides a mock function for the type DeviceConfigurationClientInterface +func (_mock *DeviceConfigurationClientInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForFilter") @@ -77,23 +103,21 @@ func (_m *DeviceConfigurationClientInterface) GetKeyValueDataForFilter(filter mo var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -110,24 +134,30 @@ func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDataForFilter( func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) + var arg0 model.DeviceConfigurationKeyValueDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call { + _c.Call.Return(deviceConfigurationKeyValueDataType, err) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call { +func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForKeyId provides a mock function with given fields: keyId -func (_m *DeviceConfigurationClientInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _m.Called(keyId) +// GetKeyValueDataForKeyId provides a mock function for the type DeviceConfigurationClientInterface +func (_mock *DeviceConfigurationClientInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _mock.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForKeyId") @@ -135,23 +165,21 @@ func (_m *DeviceConfigurationClientInterface) GetKeyValueDataForKeyId(keyId mode var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return returnFunc(keyId) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = returnFunc(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = rf(keyId) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = returnFunc(keyId) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -168,24 +196,30 @@ func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDataForKeyId(k func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyIdType)) + var arg0 model.DeviceConfigurationKeyIdType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyIdType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call { + _c.Call.Return(deviceConfigurationKeyValueDataType, err) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call { +func (_c *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionFoKeyId provides a mock function with given fields: keyId -func (_m *DeviceConfigurationClientInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _m.Called(keyId) +// GetKeyValueDescriptionFoKeyId provides a mock function for the type DeviceConfigurationClientInterface +func (_mock *DeviceConfigurationClientInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _mock.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionFoKeyId") @@ -193,23 +227,21 @@ func (_m *DeviceConfigurationClientInterface) GetKeyValueDescriptionFoKeyId(keyI var r0 *model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return returnFunc(keyId) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = returnFunc(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = rf(keyId) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = returnFunc(keyId) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -226,24 +258,30 @@ func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDescriptionFoK func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyIdType)) + var arg0 model.DeviceConfigurationKeyIdType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyIdType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call) Return(deviceConfigurationKeyValueDescriptionDataType *model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call { + _c.Call.Return(deviceConfigurationKeyValueDescriptionDataType, err) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call { +func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionsForFilter provides a mock function with given fields: filter -func (_m *DeviceConfigurationClientInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _m.Called(filter) +// GetKeyValueDescriptionsForFilter provides a mock function for the type DeviceConfigurationClientInterface +func (_mock *DeviceConfigurationClientInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionsForFilter") @@ -251,23 +289,21 @@ func (_m *DeviceConfigurationClientInterface) GetKeyValueDescriptionsForFilter(f var r0 []model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.DeviceConfigurationKeyValueDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -284,24 +320,30 @@ func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDescriptionsFo func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) + var arg0 model.DeviceConfigurationKeyValueDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call) Return(_a0 []model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call) Return(deviceConfigurationKeyValueDescriptionDataTypes []model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call { + _c.Call.Return(deviceConfigurationKeyValueDescriptionDataTypes, err) return _c } -func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call { +func (_c *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Return(run) return _c } -// RequestKeyValueDescriptions provides a mock function with given fields: selector, elements -func (_m *DeviceConfigurationClientInterface) RequestKeyValueDescriptions(selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestKeyValueDescriptions provides a mock function for the type DeviceConfigurationClientInterface +func (_mock *DeviceConfigurationClientInterface) RequestKeyValueDescriptions(selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestKeyValueDescriptions") @@ -309,23 +351,21 @@ func (_m *DeviceConfigurationClientInterface) RequestKeyValueDescriptions(select var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -343,24 +383,35 @@ func (_e *DeviceConfigurationClientInterface_Expecter) RequestKeyValueDescriptio func (_c *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call) Run(run func(selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType)) *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType), args[1].(*model.DeviceConfigurationKeyValueDescriptionDataElementsType)) + var arg0 *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType) + } + var arg1 *model.DeviceConfigurationKeyValueDescriptionDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.DeviceConfigurationKeyValueDescriptionDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call) RunAndReturn(run func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call { +func (_c *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call) RunAndReturn(run func(selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call { _c.Call.Return(run) return _c } -// RequestKeyValues provides a mock function with given fields: selector, elements -func (_m *DeviceConfigurationClientInterface) RequestKeyValues(selector *model.DeviceConfigurationKeyValueListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestKeyValues provides a mock function for the type DeviceConfigurationClientInterface +func (_mock *DeviceConfigurationClientInterface) RequestKeyValues(selector *model.DeviceConfigurationKeyValueListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestKeyValues") @@ -368,23 +419,21 @@ func (_m *DeviceConfigurationClientInterface) RequestKeyValues(selector *model.D var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -402,24 +451,35 @@ func (_e *DeviceConfigurationClientInterface_Expecter) RequestKeyValues(selector func (_c *DeviceConfigurationClientInterface_RequestKeyValues_Call) Run(run func(selector *model.DeviceConfigurationKeyValueListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDataElementsType)) *DeviceConfigurationClientInterface_RequestKeyValues_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.DeviceConfigurationKeyValueListDataSelectorsType), args[1].(*model.DeviceConfigurationKeyValueDataElementsType)) + var arg0 *model.DeviceConfigurationKeyValueListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.DeviceConfigurationKeyValueListDataSelectorsType) + } + var arg1 *model.DeviceConfigurationKeyValueDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.DeviceConfigurationKeyValueDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *DeviceConfigurationClientInterface_RequestKeyValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceConfigurationClientInterface_RequestKeyValues_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationClientInterface_RequestKeyValues_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceConfigurationClientInterface_RequestKeyValues_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *DeviceConfigurationClientInterface_RequestKeyValues_Call) RunAndReturn(run func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_RequestKeyValues_Call { +func (_c *DeviceConfigurationClientInterface_RequestKeyValues_Call) RunAndReturn(run func(selector *model.DeviceConfigurationKeyValueListDataSelectorsType, elements *model.DeviceConfigurationKeyValueDataElementsType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_RequestKeyValues_Call { _c.Call.Return(run) return _c } -// WriteKeyValues provides a mock function with given fields: data -func (_m *DeviceConfigurationClientInterface) WriteKeyValues(data []model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error) { - ret := _m.Called(data) +// WriteKeyValues provides a mock function for the type DeviceConfigurationClientInterface +func (_mock *DeviceConfigurationClientInterface) WriteKeyValues(data []model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error) { + ret := _mock.Called(data) if len(ret) == 0 { panic("no return value specified for WriteKeyValues") @@ -427,23 +487,21 @@ func (_m *DeviceConfigurationClientInterface) WriteKeyValues(data []model.Device var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func([]model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error)); ok { - return rf(data) + if returnFunc, ok := ret.Get(0).(func([]model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error)); ok { + return returnFunc(data) } - if rf, ok := ret.Get(0).(func([]model.DeviceConfigurationKeyValueDataType) *model.MsgCounterType); ok { - r0 = rf(data) + if returnFunc, ok := ret.Get(0).(func([]model.DeviceConfigurationKeyValueDataType) *model.MsgCounterType); ok { + r0 = returnFunc(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func([]model.DeviceConfigurationKeyValueDataType) error); ok { - r1 = rf(data) + if returnFunc, ok := ret.Get(1).(func([]model.DeviceConfigurationKeyValueDataType) error); ok { + r1 = returnFunc(data) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -460,31 +518,23 @@ func (_e *DeviceConfigurationClientInterface_Expecter) WriteKeyValues(data inter func (_c *DeviceConfigurationClientInterface_WriteKeyValues_Call) Run(run func(data []model.DeviceConfigurationKeyValueDataType)) *DeviceConfigurationClientInterface_WriteKeyValues_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]model.DeviceConfigurationKeyValueDataType)) + var arg0 []model.DeviceConfigurationKeyValueDataType + if args[0] != nil { + arg0 = args[0].([]model.DeviceConfigurationKeyValueDataType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationClientInterface_WriteKeyValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceConfigurationClientInterface_WriteKeyValues_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationClientInterface_WriteKeyValues_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceConfigurationClientInterface_WriteKeyValues_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *DeviceConfigurationClientInterface_WriteKeyValues_Call) RunAndReturn(run func([]model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_WriteKeyValues_Call { +func (_c *DeviceConfigurationClientInterface_WriteKeyValues_Call) RunAndReturn(run func(data []model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error)) *DeviceConfigurationClientInterface_WriteKeyValues_Call { _c.Call.Return(run) return _c } - -// NewDeviceConfigurationClientInterface creates a new instance of DeviceConfigurationClientInterface. 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 NewDeviceConfigurationClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceConfigurationClientInterface { - mock := &DeviceConfigurationClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/DeviceConfigurationCommonInterface.go b/mocks/DeviceConfigurationCommonInterface.go index 56fdc8a7..469b445d 100644 --- a/mocks/DeviceConfigurationCommonInterface.go +++ b/mocks/DeviceConfigurationCommonInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewDeviceConfigurationCommonInterface creates a new instance of DeviceConfigurationCommonInterface. 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 NewDeviceConfigurationCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceConfigurationCommonInterface { + mock := &DeviceConfigurationCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // DeviceConfigurationCommonInterface is an autogenerated mock type for the DeviceConfigurationCommonInterface type type DeviceConfigurationCommonInterface struct { mock.Mock @@ -20,21 +36,20 @@ func (_m *DeviceConfigurationCommonInterface) EXPECT() *DeviceConfigurationCommo return &DeviceConfigurationCommonInterface_Expecter{mock: &_m.Mock} } -// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter -func (_m *DeviceConfigurationCommonInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { - ret := _m.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function for the type DeviceConfigurationCommonInterface +func (_mock *DeviceConfigurationCommonInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { + ret := _mock.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { - r0 = rf(payloadData, filter) + if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { + r0 = returnFunc(payloadData, filter) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -44,32 +59,43 @@ type DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call stru } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData interface{} -// - filter interface{} +// - payloadData any +// - filter any func (_e *DeviceConfigurationCommonInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { return &DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(interface{}), args[1].(interface{})) + var arg0 any + if args[0] != nil { + arg0 = args[0].(any) + } + var arg1 any + if args[1] != nil { + arg1 = args[1].(any) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(_a0) +func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(b) return _c } -func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForFilter provides a mock function with given fields: filter -func (_m *DeviceConfigurationCommonInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _m.Called(filter) +// GetKeyValueDataForFilter provides a mock function for the type DeviceConfigurationCommonInterface +func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForFilter") @@ -77,23 +103,21 @@ func (_m *DeviceConfigurationCommonInterface) GetKeyValueDataForFilter(filter mo var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -110,24 +134,30 @@ func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDataForFilter( func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) + var arg0 model.DeviceConfigurationKeyValueDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call { + _c.Call.Return(deviceConfigurationKeyValueDataType, err) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call { +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForKeyId provides a mock function with given fields: keyId -func (_m *DeviceConfigurationCommonInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _m.Called(keyId) +// GetKeyValueDataForKeyId provides a mock function for the type DeviceConfigurationCommonInterface +func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _mock.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForKeyId") @@ -135,23 +165,21 @@ func (_m *DeviceConfigurationCommonInterface) GetKeyValueDataForKeyId(keyId mode var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return returnFunc(keyId) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = returnFunc(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = rf(keyId) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = returnFunc(keyId) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -168,24 +196,30 @@ func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDataForKeyId(k func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyIdType)) + var arg0 model.DeviceConfigurationKeyIdType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyIdType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call { + _c.Call.Return(deviceConfigurationKeyValueDataType, err) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call { +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionFoKeyId provides a mock function with given fields: keyId -func (_m *DeviceConfigurationCommonInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _m.Called(keyId) +// GetKeyValueDescriptionFoKeyId provides a mock function for the type DeviceConfigurationCommonInterface +func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _mock.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionFoKeyId") @@ -193,23 +227,21 @@ func (_m *DeviceConfigurationCommonInterface) GetKeyValueDescriptionFoKeyId(keyI var r0 *model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return returnFunc(keyId) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = returnFunc(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = rf(keyId) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = returnFunc(keyId) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -226,24 +258,30 @@ func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDescriptionFoK func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyIdType)) + var arg0 model.DeviceConfigurationKeyIdType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyIdType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call) Return(deviceConfigurationKeyValueDescriptionDataType *model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call { + _c.Call.Return(deviceConfigurationKeyValueDescriptionDataType, err) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call { +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionsForFilter provides a mock function with given fields: filter -func (_m *DeviceConfigurationCommonInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _m.Called(filter) +// GetKeyValueDescriptionsForFilter provides a mock function for the type DeviceConfigurationCommonInterface +func (_mock *DeviceConfigurationCommonInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionsForFilter") @@ -251,23 +289,21 @@ func (_m *DeviceConfigurationCommonInterface) GetKeyValueDescriptionsForFilter(f var r0 []model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.DeviceConfigurationKeyValueDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -284,31 +320,23 @@ func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDescriptionsFo func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) + var arg0 model.DeviceConfigurationKeyValueDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call) Return(_a0 []model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call) Return(deviceConfigurationKeyValueDescriptionDataTypes []model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call { + _c.Call.Return(deviceConfigurationKeyValueDescriptionDataTypes, err) return _c } -func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call { +func (_c *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Return(run) return _c } - -// NewDeviceConfigurationCommonInterface creates a new instance of DeviceConfigurationCommonInterface. 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 NewDeviceConfigurationCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceConfigurationCommonInterface { - mock := &DeviceConfigurationCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/DeviceConfigurationServerInterface.go b/mocks/DeviceConfigurationServerInterface.go index 157065da..ed35a0e0 100644 --- a/mocks/DeviceConfigurationServerInterface.go +++ b/mocks/DeviceConfigurationServerInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewDeviceConfigurationServerInterface creates a new instance of DeviceConfigurationServerInterface. 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 NewDeviceConfigurationServerInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceConfigurationServerInterface { + mock := &DeviceConfigurationServerInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // DeviceConfigurationServerInterface is an autogenerated mock type for the DeviceConfigurationServerInterface type type DeviceConfigurationServerInterface struct { mock.Mock @@ -20,23 +36,22 @@ func (_m *DeviceConfigurationServerInterface) EXPECT() *DeviceConfigurationServe return &DeviceConfigurationServerInterface_Expecter{mock: &_m.Mock} } -// AddKeyValueDescription provides a mock function with given fields: description -func (_m *DeviceConfigurationServerInterface) AddKeyValueDescription(description model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType { - ret := _m.Called(description) +// AddKeyValueDescription provides a mock function for the type DeviceConfigurationServerInterface +func (_mock *DeviceConfigurationServerInterface) AddKeyValueDescription(description model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType { + ret := _mock.Called(description) if len(ret) == 0 { panic("no return value specified for AddKeyValueDescription") } var r0 *model.DeviceConfigurationKeyIdType - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType); ok { - r0 = rf(description) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType); ok { + r0 = returnFunc(description) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyIdType) } } - return r0 } @@ -53,36 +68,41 @@ func (_e *DeviceConfigurationServerInterface_Expecter) AddKeyValueDescription(de func (_c *DeviceConfigurationServerInterface_AddKeyValueDescription_Call) Run(run func(description model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationServerInterface_AddKeyValueDescription_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) + var arg0 model.DeviceConfigurationKeyValueDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationServerInterface_AddKeyValueDescription_Call) Return(_a0 *model.DeviceConfigurationKeyIdType) *DeviceConfigurationServerInterface_AddKeyValueDescription_Call { - _c.Call.Return(_a0) +func (_c *DeviceConfigurationServerInterface_AddKeyValueDescription_Call) Return(deviceConfigurationKeyIdType *model.DeviceConfigurationKeyIdType) *DeviceConfigurationServerInterface_AddKeyValueDescription_Call { + _c.Call.Return(deviceConfigurationKeyIdType) return _c } -func (_c *DeviceConfigurationServerInterface_AddKeyValueDescription_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType) *DeviceConfigurationServerInterface_AddKeyValueDescription_Call { +func (_c *DeviceConfigurationServerInterface_AddKeyValueDescription_Call) RunAndReturn(run func(description model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType) *DeviceConfigurationServerInterface_AddKeyValueDescription_Call { _c.Call.Return(run) return _c } -// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter -func (_m *DeviceConfigurationServerInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { - ret := _m.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function for the type DeviceConfigurationServerInterface +func (_mock *DeviceConfigurationServerInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { + ret := _mock.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { - r0 = rf(payloadData, filter) + if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { + r0 = returnFunc(payloadData, filter) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -92,32 +112,43 @@ type DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call stru } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData interface{} -// - filter interface{} +// - payloadData any +// - filter any func (_e *DeviceConfigurationServerInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { return &DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(interface{}), args[1].(interface{})) + var arg0 any + if args[0] != nil { + arg0 = args[0].(any) + } + var arg1 any + if args[1] != nil { + arg1 = args[1].(any) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(_a0) +func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(b) return _c } -func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { +func (_c *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForFilter provides a mock function with given fields: filter -func (_m *DeviceConfigurationServerInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _m.Called(filter) +// GetKeyValueDataForFilter provides a mock function for the type DeviceConfigurationServerInterface +func (_mock *DeviceConfigurationServerInterface) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForFilter") @@ -125,23 +156,21 @@ func (_m *DeviceConfigurationServerInterface) GetKeyValueDataForFilter(filter mo var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -158,24 +187,30 @@ func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDataForFilter( func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) + var arg0 model.DeviceConfigurationKeyValueDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call { + _c.Call.Return(deviceConfigurationKeyValueDataType, err) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call { +func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call { _c.Call.Return(run) return _c } -// GetKeyValueDataForKeyId provides a mock function with given fields: keyId -func (_m *DeviceConfigurationServerInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { - ret := _m.Called(keyId) +// GetKeyValueDataForKeyId provides a mock function for the type DeviceConfigurationServerInterface +func (_mock *DeviceConfigurationServerInterface) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error) { + ret := _mock.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDataForKeyId") @@ -183,23 +218,21 @@ func (_m *DeviceConfigurationServerInterface) GetKeyValueDataForKeyId(keyId mode var r0 *model.DeviceConfigurationKeyValueDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { - return rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok { + return returnFunc(keyId) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { - r0 = rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDataType); ok { + r0 = returnFunc(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = rf(keyId) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = returnFunc(keyId) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -216,24 +249,30 @@ func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDataForKeyId(k func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyIdType)) + var arg0 model.DeviceConfigurationKeyIdType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyIdType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDataType, _a1 error) *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call) Return(deviceConfigurationKeyValueDataType *model.DeviceConfigurationKeyValueDataType, err error) *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call { + _c.Call.Return(deviceConfigurationKeyValueDataType, err) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call { +func (_c *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionFoKeyId provides a mock function with given fields: keyId -func (_m *DeviceConfigurationServerInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _m.Called(keyId) +// GetKeyValueDescriptionFoKeyId provides a mock function for the type DeviceConfigurationServerInterface +func (_mock *DeviceConfigurationServerInterface) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _mock.Called(keyId) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionFoKeyId") @@ -241,23 +280,21 @@ func (_m *DeviceConfigurationServerInterface) GetKeyValueDescriptionFoKeyId(keyI var r0 *model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return returnFunc(keyId) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = rf(keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) *model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = returnFunc(keyId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceConfigurationKeyValueDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { - r1 = rf(keyId) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok { + r1 = returnFunc(keyId) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -274,24 +311,30 @@ func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDescriptionFoK func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call) Run(run func(keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyIdType)) + var arg0 model.DeviceConfigurationKeyIdType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyIdType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call) Return(_a0 *model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call) Return(deviceConfigurationKeyValueDescriptionDataType *model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call { + _c.Call.Return(deviceConfigurationKeyValueDescriptionDataType, err) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call { +func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call) RunAndReturn(run func(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call { _c.Call.Return(run) return _c } -// GetKeyValueDescriptionsForFilter provides a mock function with given fields: filter -func (_m *DeviceConfigurationServerInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { - ret := _m.Called(filter) +// GetKeyValueDescriptionsForFilter provides a mock function for the type DeviceConfigurationServerInterface +func (_mock *DeviceConfigurationServerInterface) GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetKeyValueDescriptionsForFilter") @@ -299,23 +342,21 @@ func (_m *DeviceConfigurationServerInterface) GetKeyValueDescriptionsForFilter(f var r0 []model.DeviceConfigurationKeyValueDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) []model.DeviceConfigurationKeyValueDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.DeviceConfigurationKeyValueDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -332,36 +373,41 @@ func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDescriptionsFo func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call) Run(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyValueDescriptionDataType)) + var arg0 model.DeviceConfigurationKeyValueDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyValueDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call) Return(_a0 []model.DeviceConfigurationKeyValueDescriptionDataType, _a1 error) *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call) Return(deviceConfigurationKeyValueDescriptionDataTypes []model.DeviceConfigurationKeyValueDescriptionDataType, err error) *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call { + _c.Call.Return(deviceConfigurationKeyValueDescriptionDataTypes, err) return _c } -func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call { +func (_c *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call) RunAndReturn(run func(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)) *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call { _c.Call.Return(run) return _c } -// UpdateKeyValueDataForFilter provides a mock function with given fields: data, deleteElements, filter -func (_m *DeviceConfigurationServerInterface) UpdateKeyValueDataForFilter(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, filter model.DeviceConfigurationKeyValueDescriptionDataType) error { - ret := _m.Called(data, deleteElements, filter) +// UpdateKeyValueDataForFilter provides a mock function for the type DeviceConfigurationServerInterface +func (_mock *DeviceConfigurationServerInterface) UpdateKeyValueDataForFilter(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, filter model.DeviceConfigurationKeyValueDescriptionDataType) error { + ret := _mock.Called(data, deleteElements, filter) if len(ret) == 0 { panic("no return value specified for UpdateKeyValueDataForFilter") } var r0 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { - r0 = rf(data, deleteElements, filter) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyValueDescriptionDataType) error); ok { + r0 = returnFunc(data, deleteElements, filter) } else { r0 = ret.Error(0) } - return r0 } @@ -380,36 +426,51 @@ func (_e *DeviceConfigurationServerInterface_Expecter) UpdateKeyValueDataForFilt func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call) Run(run func(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, filter model.DeviceConfigurationKeyValueDescriptionDataType)) *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyValueDataType), args[1].(*model.DeviceConfigurationKeyValueDataElementsType), args[2].(model.DeviceConfigurationKeyValueDescriptionDataType)) + var arg0 model.DeviceConfigurationKeyValueDataType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyValueDataType) + } + var arg1 *model.DeviceConfigurationKeyValueDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.DeviceConfigurationKeyValueDataElementsType) + } + var arg2 model.DeviceConfigurationKeyValueDescriptionDataType + if args[2] != nil { + arg2 = args[2].(model.DeviceConfigurationKeyValueDescriptionDataType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call) Return(_a0 error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call { - _c.Call.Return(_a0) +func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call) Return(err error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call { + _c.Call.Return(err) return _c } -func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyValueDescriptionDataType) error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call { +func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call) RunAndReturn(run func(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, filter model.DeviceConfigurationKeyValueDescriptionDataType) error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call { _c.Call.Return(run) return _c } -// UpdateKeyValueDataForKeyId provides a mock function with given fields: data, deleteElements, keyId -func (_m *DeviceConfigurationServerInterface) UpdateKeyValueDataForKeyId(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, keyId model.DeviceConfigurationKeyIdType) error { - ret := _m.Called(data, deleteElements, keyId) +// UpdateKeyValueDataForKeyId provides a mock function for the type DeviceConfigurationServerInterface +func (_mock *DeviceConfigurationServerInterface) UpdateKeyValueDataForKeyId(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, keyId model.DeviceConfigurationKeyIdType) error { + ret := _mock.Called(data, deleteElements, keyId) if len(ret) == 0 { panic("no return value specified for UpdateKeyValueDataForKeyId") } var r0 error - if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyIdType) error); ok { - r0 = rf(data, deleteElements, keyId) + if returnFunc, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyIdType) error); ok { + r0 = returnFunc(data, deleteElements, keyId) } else { r0 = ret.Error(0) } - return r0 } @@ -428,31 +489,33 @@ func (_e *DeviceConfigurationServerInterface_Expecter) UpdateKeyValueDataForKeyI func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call) Run(run func(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, keyId model.DeviceConfigurationKeyIdType)) *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceConfigurationKeyValueDataType), args[1].(*model.DeviceConfigurationKeyValueDataElementsType), args[2].(model.DeviceConfigurationKeyIdType)) + var arg0 model.DeviceConfigurationKeyValueDataType + if args[0] != nil { + arg0 = args[0].(model.DeviceConfigurationKeyValueDataType) + } + var arg1 *model.DeviceConfigurationKeyValueDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.DeviceConfigurationKeyValueDataElementsType) + } + var arg2 model.DeviceConfigurationKeyIdType + if args[2] != nil { + arg2 = args[2].(model.DeviceConfigurationKeyIdType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call) Return(_a0 error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call { - _c.Call.Return(_a0) +func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call) Return(err error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call { + _c.Call.Return(err) return _c } -func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call) RunAndReturn(run func(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, model.DeviceConfigurationKeyIdType) error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call { +func (_c *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call) RunAndReturn(run func(data model.DeviceConfigurationKeyValueDataType, deleteElements *model.DeviceConfigurationKeyValueDataElementsType, keyId model.DeviceConfigurationKeyIdType) error) *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call { _c.Call.Return(run) return _c } - -// NewDeviceConfigurationServerInterface creates a new instance of DeviceConfigurationServerInterface. 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 NewDeviceConfigurationServerInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceConfigurationServerInterface { - mock := &DeviceConfigurationServerInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/DeviceDiagnosisClientInterface.go b/mocks/DeviceDiagnosisClientInterface.go index cd1c0aba..5c055802 100644 --- a/mocks/DeviceDiagnosisClientInterface.go +++ b/mocks/DeviceDiagnosisClientInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewDeviceDiagnosisClientInterface creates a new instance of DeviceDiagnosisClientInterface. 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 NewDeviceDiagnosisClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceDiagnosisClientInterface { + mock := &DeviceDiagnosisClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // DeviceDiagnosisClientInterface is an autogenerated mock type for the DeviceDiagnosisClientInterface type type DeviceDiagnosisClientInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *DeviceDiagnosisClientInterface) EXPECT() *DeviceDiagnosisClientInterfa return &DeviceDiagnosisClientInterface_Expecter{mock: &_m.Mock} } -// RequestHeartbeat provides a mock function with no fields -func (_m *DeviceDiagnosisClientInterface) RequestHeartbeat() (*model.MsgCounterType, error) { - ret := _m.Called() +// RequestHeartbeat provides a mock function for the type DeviceDiagnosisClientInterface +func (_mock *DeviceDiagnosisClientInterface) RequestHeartbeat() (*model.MsgCounterType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RequestHeartbeat") @@ -30,23 +46,21 @@ func (_m *DeviceDiagnosisClientInterface) RequestHeartbeat() (*model.MsgCounterT var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -67,8 +81,8 @@ func (_c *DeviceDiagnosisClientInterface_RequestHeartbeat_Call) Run(run func()) return _c } -func (_c *DeviceDiagnosisClientInterface_RequestHeartbeat_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceDiagnosisClientInterface_RequestHeartbeat_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceDiagnosisClientInterface_RequestHeartbeat_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceDiagnosisClientInterface_RequestHeartbeat_Call { + _c.Call.Return(msgCounterType, err) return _c } @@ -77,9 +91,9 @@ func (_c *DeviceDiagnosisClientInterface_RequestHeartbeat_Call) RunAndReturn(run return _c } -// RequestState provides a mock function with no fields -func (_m *DeviceDiagnosisClientInterface) RequestState() (*model.MsgCounterType, error) { - ret := _m.Called() +// RequestState provides a mock function for the type DeviceDiagnosisClientInterface +func (_mock *DeviceDiagnosisClientInterface) RequestState() (*model.MsgCounterType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RequestState") @@ -87,23 +101,21 @@ func (_m *DeviceDiagnosisClientInterface) RequestState() (*model.MsgCounterType, var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -124,8 +136,8 @@ func (_c *DeviceDiagnosisClientInterface_RequestState_Call) Run(run func()) *Dev return _c } -func (_c *DeviceDiagnosisClientInterface_RequestState_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceDiagnosisClientInterface_RequestState_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceDiagnosisClientInterface_RequestState_Call) Return(msgCounterType *model.MsgCounterType, err error) *DeviceDiagnosisClientInterface_RequestState_Call { + _c.Call.Return(msgCounterType, err) return _c } @@ -133,17 +145,3 @@ func (_c *DeviceDiagnosisClientInterface_RequestState_Call) RunAndReturn(run fun _c.Call.Return(run) return _c } - -// NewDeviceDiagnosisClientInterface creates a new instance of DeviceDiagnosisClientInterface. 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 NewDeviceDiagnosisClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceDiagnosisClientInterface { - mock := &DeviceDiagnosisClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/DeviceDiagnosisCommonInterface.go b/mocks/DeviceDiagnosisCommonInterface.go index 5a7a1da3..68533d23 100644 --- a/mocks/DeviceDiagnosisCommonInterface.go +++ b/mocks/DeviceDiagnosisCommonInterface.go @@ -1,14 +1,30 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" - mock "github.com/stretchr/testify/mock" + "time" - time "time" + "github.com/enbility/spine-go/model" + mock "github.com/stretchr/testify/mock" ) +// NewDeviceDiagnosisCommonInterface creates a new instance of DeviceDiagnosisCommonInterface. 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 NewDeviceDiagnosisCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceDiagnosisCommonInterface { + mock := &DeviceDiagnosisCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // DeviceDiagnosisCommonInterface is an autogenerated mock type for the DeviceDiagnosisCommonInterface type type DeviceDiagnosisCommonInterface struct { mock.Mock @@ -22,9 +38,9 @@ func (_m *DeviceDiagnosisCommonInterface) EXPECT() *DeviceDiagnosisCommonInterfa return &DeviceDiagnosisCommonInterface_Expecter{mock: &_m.Mock} } -// GetState provides a mock function with no fields -func (_m *DeviceDiagnosisCommonInterface) GetState() (*model.DeviceDiagnosisStateDataType, error) { - ret := _m.Called() +// GetState provides a mock function for the type DeviceDiagnosisCommonInterface +func (_mock *DeviceDiagnosisCommonInterface) GetState() (*model.DeviceDiagnosisStateDataType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for GetState") @@ -32,23 +48,21 @@ func (_m *DeviceDiagnosisCommonInterface) GetState() (*model.DeviceDiagnosisStat var r0 *model.DeviceDiagnosisStateDataType var r1 error - if rf, ok := ret.Get(0).(func() (*model.DeviceDiagnosisStateDataType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.DeviceDiagnosisStateDataType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.DeviceDiagnosisStateDataType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.DeviceDiagnosisStateDataType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.DeviceDiagnosisStateDataType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -69,8 +83,8 @@ func (_c *DeviceDiagnosisCommonInterface_GetState_Call) Run(run func()) *DeviceD return _c } -func (_c *DeviceDiagnosisCommonInterface_GetState_Call) Return(_a0 *model.DeviceDiagnosisStateDataType, _a1 error) *DeviceDiagnosisCommonInterface_GetState_Call { - _c.Call.Return(_a0, _a1) +func (_c *DeviceDiagnosisCommonInterface_GetState_Call) Return(deviceDiagnosisStateDataType *model.DeviceDiagnosisStateDataType, err error) *DeviceDiagnosisCommonInterface_GetState_Call { + _c.Call.Return(deviceDiagnosisStateDataType, err) return _c } @@ -79,21 +93,20 @@ func (_c *DeviceDiagnosisCommonInterface_GetState_Call) RunAndReturn(run func() return _c } -// IsHeartbeatWithinDuration provides a mock function with given fields: duration -func (_m *DeviceDiagnosisCommonInterface) IsHeartbeatWithinDuration(duration time.Duration) bool { - ret := _m.Called(duration) +// IsHeartbeatWithinDuration provides a mock function for the type DeviceDiagnosisCommonInterface +func (_mock *DeviceDiagnosisCommonInterface) IsHeartbeatWithinDuration(duration time.Duration) bool { + ret := _mock.Called(duration) if len(ret) == 0 { panic("no return value specified for IsHeartbeatWithinDuration") } var r0 bool - if rf, ok := ret.Get(0).(func(time.Duration) bool); ok { - r0 = rf(duration) + if returnFunc, ok := ret.Get(0).(func(time.Duration) bool); ok { + r0 = returnFunc(duration) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -110,31 +123,23 @@ func (_e *DeviceDiagnosisCommonInterface_Expecter) IsHeartbeatWithinDuration(dur func (_c *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call) Run(run func(duration time.Duration)) *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(time.Duration)) + var arg0 time.Duration + if args[0] != nil { + arg0 = args[0].(time.Duration) + } + run( + arg0, + ) }) return _c } -func (_c *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call) Return(_a0 bool) *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call { - _c.Call.Return(_a0) +func (_c *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call) Return(b bool) *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call { + _c.Call.Return(b) return _c } -func (_c *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(time.Duration) bool) *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call { +func (_c *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(duration time.Duration) bool) *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call { _c.Call.Return(run) return _c } - -// NewDeviceDiagnosisCommonInterface creates a new instance of DeviceDiagnosisCommonInterface. 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 NewDeviceDiagnosisCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceDiagnosisCommonInterface { - mock := &DeviceDiagnosisCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/DeviceDiagnosisServerInterface.go b/mocks/DeviceDiagnosisServerInterface.go index ed83c1b0..f3bda40e 100644 --- a/mocks/DeviceDiagnosisServerInterface.go +++ b/mocks/DeviceDiagnosisServerInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewDeviceDiagnosisServerInterface creates a new instance of DeviceDiagnosisServerInterface. 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 NewDeviceDiagnosisServerInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *DeviceDiagnosisServerInterface { + mock := &DeviceDiagnosisServerInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // DeviceDiagnosisServerInterface is an autogenerated mock type for the DeviceDiagnosisServerInterface type type DeviceDiagnosisServerInterface struct { mock.Mock @@ -20,9 +36,10 @@ func (_m *DeviceDiagnosisServerInterface) EXPECT() *DeviceDiagnosisServerInterfa return &DeviceDiagnosisServerInterface_Expecter{mock: &_m.Mock} } -// SetLocalOperatingState provides a mock function with given fields: operatingState -func (_m *DeviceDiagnosisServerInterface) SetLocalOperatingState(operatingState model.DeviceDiagnosisOperatingStateType) { - _m.Called(operatingState) +// SetLocalOperatingState provides a mock function for the type DeviceDiagnosisServerInterface +func (_mock *DeviceDiagnosisServerInterface) SetLocalOperatingState(operatingState model.DeviceDiagnosisOperatingStateType) { + _mock.Called(operatingState) + return } // DeviceDiagnosisServerInterface_SetLocalOperatingState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetLocalOperatingState' @@ -38,7 +55,13 @@ func (_e *DeviceDiagnosisServerInterface_Expecter) SetLocalOperatingState(operat func (_c *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call) Run(run func(operatingState model.DeviceDiagnosisOperatingStateType)) *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.DeviceDiagnosisOperatingStateType)) + var arg0 model.DeviceDiagnosisOperatingStateType + if args[0] != nil { + arg0 = args[0].(model.DeviceDiagnosisOperatingStateType) + } + run( + arg0, + ) }) return _c } @@ -48,14 +71,15 @@ func (_c *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call) Return() * return _c } -func (_c *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call) RunAndReturn(run func(model.DeviceDiagnosisOperatingStateType)) *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call { +func (_c *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call) RunAndReturn(run func(operatingState model.DeviceDiagnosisOperatingStateType)) *DeviceDiagnosisServerInterface_SetLocalOperatingState_Call { _c.Run(run) return _c } -// SetLocalState provides a mock function with given fields: statetate -func (_m *DeviceDiagnosisServerInterface) SetLocalState(statetate *model.DeviceDiagnosisStateDataType) { - _m.Called(statetate) +// SetLocalState provides a mock function for the type DeviceDiagnosisServerInterface +func (_mock *DeviceDiagnosisServerInterface) SetLocalState(statetate *model.DeviceDiagnosisStateDataType) { + _mock.Called(statetate) + return } // DeviceDiagnosisServerInterface_SetLocalState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetLocalState' @@ -71,7 +95,13 @@ func (_e *DeviceDiagnosisServerInterface_Expecter) SetLocalState(statetate inter func (_c *DeviceDiagnosisServerInterface_SetLocalState_Call) Run(run func(statetate *model.DeviceDiagnosisStateDataType)) *DeviceDiagnosisServerInterface_SetLocalState_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.DeviceDiagnosisStateDataType)) + var arg0 *model.DeviceDiagnosisStateDataType + if args[0] != nil { + arg0 = args[0].(*model.DeviceDiagnosisStateDataType) + } + run( + arg0, + ) }) return _c } @@ -81,21 +111,7 @@ func (_c *DeviceDiagnosisServerInterface_SetLocalState_Call) Return() *DeviceDia return _c } -func (_c *DeviceDiagnosisServerInterface_SetLocalState_Call) RunAndReturn(run func(*model.DeviceDiagnosisStateDataType)) *DeviceDiagnosisServerInterface_SetLocalState_Call { +func (_c *DeviceDiagnosisServerInterface_SetLocalState_Call) RunAndReturn(run func(statetate *model.DeviceDiagnosisStateDataType)) *DeviceDiagnosisServerInterface_SetLocalState_Call { _c.Run(run) return _c } - -// NewDeviceDiagnosisServerInterface creates a new instance of DeviceDiagnosisServerInterface. 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 NewDeviceDiagnosisServerInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *DeviceDiagnosisServerInterface { - mock := &DeviceDiagnosisServerInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/ElectricalConnectionClientInterface.go b/mocks/ElectricalConnectionClientInterface.go index e71ec37f..71343d3b 100644 --- a/mocks/ElectricalConnectionClientInterface.go +++ b/mocks/ElectricalConnectionClientInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewElectricalConnectionClientInterface creates a new instance of ElectricalConnectionClientInterface. 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 NewElectricalConnectionClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *ElectricalConnectionClientInterface { + mock := &ElectricalConnectionClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // ElectricalConnectionClientInterface is an autogenerated mock type for the ElectricalConnectionClientInterface type type ElectricalConnectionClientInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *ElectricalConnectionClientInterface) EXPECT() *ElectricalConnectionCli return &ElectricalConnectionClientInterface_Expecter{mock: &_m.Mock} } -// RequestCharacteristics provides a mock function with given fields: selector, elements -func (_m *ElectricalConnectionClientInterface) RequestCharacteristics(selector *model.ElectricalConnectionCharacteristicListDataSelectorsType, elements *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestCharacteristics provides a mock function for the type ElectricalConnectionClientInterface +func (_mock *ElectricalConnectionClientInterface) RequestCharacteristics(selector *model.ElectricalConnectionCharacteristicListDataSelectorsType, elements *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestCharacteristics") @@ -30,23 +46,21 @@ func (_m *ElectricalConnectionClientInterface) RequestCharacteristics(selector * var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -64,24 +78,35 @@ func (_e *ElectricalConnectionClientInterface_Expecter) RequestCharacteristics(s func (_c *ElectricalConnectionClientInterface_RequestCharacteristics_Call) Run(run func(selector *model.ElectricalConnectionCharacteristicListDataSelectorsType, elements *model.ElectricalConnectionCharacteristicDataElementsType)) *ElectricalConnectionClientInterface_RequestCharacteristics_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.ElectricalConnectionCharacteristicListDataSelectorsType), args[1].(*model.ElectricalConnectionCharacteristicDataElementsType)) + var arg0 *model.ElectricalConnectionCharacteristicListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.ElectricalConnectionCharacteristicListDataSelectorsType) + } + var arg1 *model.ElectricalConnectionCharacteristicDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.ElectricalConnectionCharacteristicDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *ElectricalConnectionClientInterface_RequestCharacteristics_Call) Return(_a0 *model.MsgCounterType, _a1 error) *ElectricalConnectionClientInterface_RequestCharacteristics_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionClientInterface_RequestCharacteristics_Call) Return(msgCounterType *model.MsgCounterType, err error) *ElectricalConnectionClientInterface_RequestCharacteristics_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *ElectricalConnectionClientInterface_RequestCharacteristics_Call) RunAndReturn(run func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestCharacteristics_Call { +func (_c *ElectricalConnectionClientInterface_RequestCharacteristics_Call) RunAndReturn(run func(selector *model.ElectricalConnectionCharacteristicListDataSelectorsType, elements *model.ElectricalConnectionCharacteristicDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestCharacteristics_Call { _c.Call.Return(run) return _c } -// RequestDescriptions provides a mock function with given fields: selector, elements -func (_m *ElectricalConnectionClientInterface) RequestDescriptions(selector *model.ElectricalConnectionDescriptionListDataSelectorsType, elements *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestDescriptions provides a mock function for the type ElectricalConnectionClientInterface +func (_mock *ElectricalConnectionClientInterface) RequestDescriptions(selector *model.ElectricalConnectionDescriptionListDataSelectorsType, elements *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestDescriptions") @@ -89,23 +114,21 @@ func (_m *ElectricalConnectionClientInterface) RequestDescriptions(selector *mod var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -123,24 +146,35 @@ func (_e *ElectricalConnectionClientInterface_Expecter) RequestDescriptions(sele func (_c *ElectricalConnectionClientInterface_RequestDescriptions_Call) Run(run func(selector *model.ElectricalConnectionDescriptionListDataSelectorsType, elements *model.ElectricalConnectionDescriptionDataElementsType)) *ElectricalConnectionClientInterface_RequestDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.ElectricalConnectionDescriptionListDataSelectorsType), args[1].(*model.ElectricalConnectionDescriptionDataElementsType)) + var arg0 *model.ElectricalConnectionDescriptionListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.ElectricalConnectionDescriptionListDataSelectorsType) + } + var arg1 *model.ElectricalConnectionDescriptionDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.ElectricalConnectionDescriptionDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *ElectricalConnectionClientInterface_RequestDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *ElectricalConnectionClientInterface_RequestDescriptions_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionClientInterface_RequestDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *ElectricalConnectionClientInterface_RequestDescriptions_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *ElectricalConnectionClientInterface_RequestDescriptions_Call) RunAndReturn(run func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestDescriptions_Call { +func (_c *ElectricalConnectionClientInterface_RequestDescriptions_Call) RunAndReturn(run func(selector *model.ElectricalConnectionDescriptionListDataSelectorsType, elements *model.ElectricalConnectionDescriptionDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestDescriptions_Call { _c.Call.Return(run) return _c } -// RequestParameterDescriptions provides a mock function with given fields: selector, elements -func (_m *ElectricalConnectionClientInterface) RequestParameterDescriptions(selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType, elements *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestParameterDescriptions provides a mock function for the type ElectricalConnectionClientInterface +func (_mock *ElectricalConnectionClientInterface) RequestParameterDescriptions(selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType, elements *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestParameterDescriptions") @@ -148,23 +182,21 @@ func (_m *ElectricalConnectionClientInterface) RequestParameterDescriptions(sele var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -182,24 +214,35 @@ func (_e *ElectricalConnectionClientInterface_Expecter) RequestParameterDescript func (_c *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call) Run(run func(selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType, elements *model.ElectricalConnectionParameterDescriptionDataElementsType)) *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType), args[1].(*model.ElectricalConnectionParameterDescriptionDataElementsType)) + var arg0 *model.ElectricalConnectionParameterDescriptionListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType) + } + var arg1 *model.ElectricalConnectionParameterDescriptionDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.ElectricalConnectionParameterDescriptionDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call) RunAndReturn(run func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call { +func (_c *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call) RunAndReturn(run func(selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType, elements *model.ElectricalConnectionParameterDescriptionDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call { _c.Call.Return(run) return _c } -// RequestPermittedValueSets provides a mock function with given fields: selector, elements -func (_m *ElectricalConnectionClientInterface) RequestPermittedValueSets(selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, elements *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestPermittedValueSets provides a mock function for the type ElectricalConnectionClientInterface +func (_mock *ElectricalConnectionClientInterface) RequestPermittedValueSets(selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, elements *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestPermittedValueSets") @@ -207,23 +250,21 @@ func (_m *ElectricalConnectionClientInterface) RequestPermittedValueSets(selecto var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -241,31 +282,28 @@ func (_e *ElectricalConnectionClientInterface_Expecter) RequestPermittedValueSet func (_c *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call) Run(run func(selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, elements *model.ElectricalConnectionPermittedValueSetDataElementsType)) *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType), args[1].(*model.ElectricalConnectionPermittedValueSetDataElementsType)) + var arg0 *model.ElectricalConnectionPermittedValueSetListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType) + } + var arg1 *model.ElectricalConnectionPermittedValueSetDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.ElectricalConnectionPermittedValueSetDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call) Return(_a0 *model.MsgCounterType, _a1 error) *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call) Return(msgCounterType *model.MsgCounterType, err error) *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call) RunAndReturn(run func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call { +func (_c *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call) RunAndReturn(run func(selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, elements *model.ElectricalConnectionPermittedValueSetDataElementsType) (*model.MsgCounterType, error)) *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call { _c.Call.Return(run) return _c } - -// NewElectricalConnectionClientInterface creates a new instance of ElectricalConnectionClientInterface. 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 NewElectricalConnectionClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *ElectricalConnectionClientInterface { - mock := &ElectricalConnectionClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/ElectricalConnectionCommonInterface.go b/mocks/ElectricalConnectionCommonInterface.go index 20e466cc..1faafc8b 100644 --- a/mocks/ElectricalConnectionCommonInterface.go +++ b/mocks/ElectricalConnectionCommonInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewElectricalConnectionCommonInterface creates a new instance of ElectricalConnectionCommonInterface. 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 NewElectricalConnectionCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *ElectricalConnectionCommonInterface { + mock := &ElectricalConnectionCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // ElectricalConnectionCommonInterface is an autogenerated mock type for the ElectricalConnectionCommonInterface type type ElectricalConnectionCommonInterface struct { mock.Mock @@ -20,21 +36,20 @@ func (_m *ElectricalConnectionCommonInterface) EXPECT() *ElectricalConnectionCom return &ElectricalConnectionCommonInterface_Expecter{mock: &_m.Mock} } -// AdjustValueToBeWithinPermittedValuesForParameterId provides a mock function with given fields: value, parameterId -func (_m *ElectricalConnectionCommonInterface) AdjustValueToBeWithinPermittedValuesForParameterId(value float64, parameterId model.ElectricalConnectionParameterIdType) float64 { - ret := _m.Called(value, parameterId) +// AdjustValueToBeWithinPermittedValuesForParameterId provides a mock function for the type ElectricalConnectionCommonInterface +func (_mock *ElectricalConnectionCommonInterface) AdjustValueToBeWithinPermittedValuesForParameterId(value float64, parameterId model.ElectricalConnectionParameterIdType) float64 { + ret := _mock.Called(value, parameterId) if len(ret) == 0 { panic("no return value specified for AdjustValueToBeWithinPermittedValuesForParameterId") } var r0 float64 - if rf, ok := ret.Get(0).(func(float64, model.ElectricalConnectionParameterIdType) float64); ok { - r0 = rf(value, parameterId) + if returnFunc, ok := ret.Get(0).(func(float64, model.ElectricalConnectionParameterIdType) float64); ok { + r0 = returnFunc(value, parameterId) } else { r0 = ret.Get(0).(float64) } - return r0 } @@ -52,36 +67,46 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) AdjustValueToBeWithinPer func (_c *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Run(run func(value float64, parameterId model.ElectricalConnectionParameterIdType)) *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(model.ElectricalConnectionParameterIdType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 model.ElectricalConnectionParameterIdType + if args[1] != nil { + arg1 = args[1].(model.ElectricalConnectionParameterIdType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Return(_a0 float64) *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { - _c.Call.Return(_a0) +func (_c *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Return(f float64) *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { + _c.Call.Return(f) return _c } -func (_c *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) RunAndReturn(run func(float64, model.ElectricalConnectionParameterIdType) float64) *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { +func (_c *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) RunAndReturn(run func(value float64, parameterId model.ElectricalConnectionParameterIdType) float64) *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { _c.Call.Return(run) return _c } -// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter -func (_m *ElectricalConnectionCommonInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { - ret := _m.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function for the type ElectricalConnectionCommonInterface +func (_mock *ElectricalConnectionCommonInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { + ret := _mock.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { - r0 = rf(payloadData, filter) + if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { + r0 = returnFunc(payloadData, filter) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -91,32 +116,43 @@ type ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call str } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData interface{} -// - filter interface{} +// - payloadData any +// - filter any func (_e *ElectricalConnectionCommonInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { return &ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(interface{}), args[1].(interface{})) + var arg0 any + if args[0] != nil { + arg0 = args[0].(any) + } + var arg1 any + if args[1] != nil { + arg1 = args[1].(any) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(_a0) +func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(b) return _c } -func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetCharacteristicsForFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionCommonInterface) GetCharacteristicsForFilter(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error) { - ret := _m.Called(filter) +// GetCharacteristicsForFilter provides a mock function for the type ElectricalConnectionCommonInterface +func (_mock *ElectricalConnectionCommonInterface) GetCharacteristicsForFilter(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetCharacteristicsForFilter") @@ -124,23 +160,21 @@ func (_m *ElectricalConnectionCommonInterface) GetCharacteristicsForFilter(filte var r0 []model.ElectricalConnectionCharacteristicDataType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) []model.ElectricalConnectionCharacteristicDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) []model.ElectricalConnectionCharacteristicDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionCharacteristicDataType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -157,24 +191,30 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetCharacteristicsForFil func (_c *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call) Run(run func(filter model.ElectricalConnectionCharacteristicDataType)) *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionCharacteristicDataType)) + var arg0 model.ElectricalConnectionCharacteristicDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionCharacteristicDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call) Return(_a0 []model.ElectricalConnectionCharacteristicDataType, _a1 error) *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call) Return(electricalConnectionCharacteristicDataTypes []model.ElectricalConnectionCharacteristicDataType, err error) *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call { + _c.Call.Return(electricalConnectionCharacteristicDataTypes, err) return _c } -func (_c *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)) *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)) *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call { _c.Call.Return(run) return _c } -// GetDescriptionForParameterDescriptionFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionCommonInterface) GetDescriptionForParameterDescriptionFilter(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error) { - ret := _m.Called(filter) +// GetDescriptionForParameterDescriptionFilter provides a mock function for the type ElectricalConnectionCommonInterface +func (_mock *ElectricalConnectionCommonInterface) GetDescriptionForParameterDescriptionFilter(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionForParameterDescriptionFilter") @@ -182,23 +222,21 @@ func (_m *ElectricalConnectionCommonInterface) GetDescriptionForParameterDescrip var r0 *model.ElectricalConnectionDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.ElectricalConnectionDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -215,24 +253,30 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetDescriptionForParamet func (_c *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call) Run(run func(filter model.ElectricalConnectionParameterDescriptionDataType)) *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionParameterDescriptionDataType)) + var arg0 model.ElectricalConnectionParameterDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionParameterDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call) Return(_a0 *model.ElectricalConnectionDescriptionDataType, _a1 error) *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call) Return(electricalConnectionDescriptionDataType *model.ElectricalConnectionDescriptionDataType, err error) *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call { + _c.Call.Return(electricalConnectionDescriptionDataType, err) return _c } -func (_c *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call) RunAndReturn(run func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call { _c.Call.Return(run) return _c } -// GetDescriptionsForFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionCommonInterface) GetDescriptionsForFilter(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error) { - ret := _m.Called(filter) +// GetDescriptionsForFilter provides a mock function for the type ElectricalConnectionCommonInterface +func (_mock *ElectricalConnectionCommonInterface) GetDescriptionsForFilter(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionsForFilter") @@ -240,23 +284,21 @@ func (_m *ElectricalConnectionCommonInterface) GetDescriptionsForFilter(filter m var r0 []model.ElectricalConnectionDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) []model.ElectricalConnectionDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) []model.ElectricalConnectionDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -273,24 +315,30 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetDescriptionsForFilter func (_c *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call) Run(run func(filter model.ElectricalConnectionDescriptionDataType)) *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionDescriptionDataType)) + var arg0 model.ElectricalConnectionDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call) Return(_a0 []model.ElectricalConnectionDescriptionDataType, _a1 error) *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call) Return(electricalConnectionDescriptionDataTypes []model.ElectricalConnectionDescriptionDataType, err error) *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call { + _c.Call.Return(electricalConnectionDescriptionDataTypes, err) return _c } -func (_c *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Return(run) return _c } -// GetParameterDescriptionsForFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionCommonInterface) GetParameterDescriptionsForFilter(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error) { - ret := _m.Called(filter) +// GetParameterDescriptionsForFilter provides a mock function for the type ElectricalConnectionCommonInterface +func (_mock *ElectricalConnectionCommonInterface) GetParameterDescriptionsForFilter(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetParameterDescriptionsForFilter") @@ -298,23 +346,21 @@ func (_m *ElectricalConnectionCommonInterface) GetParameterDescriptionsForFilter var r0 []model.ElectricalConnectionParameterDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) []model.ElectricalConnectionParameterDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) []model.ElectricalConnectionParameterDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionParameterDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -331,24 +377,30 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetParameterDescriptions func (_c *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call) Run(run func(filter model.ElectricalConnectionParameterDescriptionDataType)) *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionParameterDescriptionDataType)) + var arg0 model.ElectricalConnectionParameterDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionParameterDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call) Return(_a0 []model.ElectricalConnectionParameterDescriptionDataType, _a1 error) *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call) Return(electricalConnectionParameterDescriptionDataTypes []model.ElectricalConnectionParameterDescriptionDataType, err error) *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call { + _c.Call.Return(electricalConnectionParameterDescriptionDataTypes, err) return _c } -func (_c *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)) *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call { _c.Call.Return(run) return _c } -// GetPermittedValueDataForFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionCommonInterface) GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error) { - ret := _m.Called(filter) +// GetPermittedValueDataForFilter provides a mock function for the type ElectricalConnectionCommonInterface +func (_mock *ElectricalConnectionCommonInterface) GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetPermittedValueDataForFilter") @@ -358,33 +410,29 @@ func (_m *ElectricalConnectionCommonInterface) GetPermittedValueDataForFilter(fi var r1 float64 var r2 float64 var r3 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r0 = returnFunc(filter) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r1 = returnFunc(filter) } else { r1 = ret.Get(1).(float64) } - - if rf, ok := ret.Get(2).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r2 = rf(filter) + if returnFunc, ok := ret.Get(2).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r2 = returnFunc(filter) } else { r2 = ret.Get(2).(float64) } - - if rf, ok := ret.Get(3).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { - r3 = rf(filter) + if returnFunc, ok := ret.Get(3).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { + r3 = returnFunc(filter) } else { r3 = ret.Error(3) } - return r0, r1, r2, r3 } @@ -401,24 +449,30 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetPermittedValueDataFor func (_c *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call) Run(run func(filter model.ElectricalConnectionPermittedValueSetDataType)) *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionPermittedValueSetDataType)) + var arg0 model.ElectricalConnectionPermittedValueSetDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionPermittedValueSetDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call) Return(_a0 float64, _a1 float64, _a2 float64, _a3 error) *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call { - _c.Call.Return(_a0, _a1, _a2, _a3) +func (_c *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call) Return(f float64, f1 float64, f2 float64, err error) *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call { + _c.Call.Return(f, f1, f2, err) return _c } -func (_c *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)) *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)) *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call { _c.Call.Return(run) return _c } -// GetPermittedValueSetForFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionCommonInterface) GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error) { - ret := _m.Called(filter) +// GetPermittedValueSetForFilter provides a mock function for the type ElectricalConnectionCommonInterface +func (_mock *ElectricalConnectionCommonInterface) GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetPermittedValueSetForFilter") @@ -426,23 +480,21 @@ func (_m *ElectricalConnectionCommonInterface) GetPermittedValueSetForFilter(fil var r0 []model.ElectricalConnectionPermittedValueSetDataType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) []model.ElectricalConnectionPermittedValueSetDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) []model.ElectricalConnectionPermittedValueSetDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionPermittedValueSetDataType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -459,24 +511,30 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetPermittedValueSetForF func (_c *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call) Run(run func(filter model.ElectricalConnectionPermittedValueSetDataType)) *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionPermittedValueSetDataType)) + var arg0 model.ElectricalConnectionPermittedValueSetDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionPermittedValueSetDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call) Return(_a0 []model.ElectricalConnectionPermittedValueSetDataType, _a1 error) *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call) Return(electricalConnectionPermittedValueSetDataTypes []model.ElectricalConnectionPermittedValueSetDataType, err error) *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call { + _c.Call.Return(electricalConnectionPermittedValueSetDataTypes, err) return _c } -func (_c *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)) *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call { +func (_c *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)) *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call { _c.Call.Return(run) return _c } -// GetPhaseCurrentLimits provides a mock function with given fields: measDesc -func (_m *ElectricalConnectionCommonInterface) GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error) { - ret := _m.Called(measDesc) +// GetPhaseCurrentLimits provides a mock function for the type ElectricalConnectionCommonInterface +func (_mock *ElectricalConnectionCommonInterface) GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error) { + ret := _mock.Called(measDesc) if len(ret) == 0 { panic("no return value specified for GetPhaseCurrentLimits") @@ -486,39 +544,35 @@ func (_m *ElectricalConnectionCommonInterface) GetPhaseCurrentLimits(measDesc [] var r1 []float64 var r2 []float64 var r3 error - if rf, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)); ok { - return rf(measDesc) + if returnFunc, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)); ok { + return returnFunc(measDesc) } - if rf, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r0 = rf(measDesc) + if returnFunc, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r0 = returnFunc(measDesc) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r1 = rf(measDesc) + if returnFunc, ok := ret.Get(1).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r1 = returnFunc(measDesc) } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]float64) } } - - if rf, ok := ret.Get(2).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r2 = rf(measDesc) + if returnFunc, ok := ret.Get(2).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r2 = returnFunc(measDesc) } else { if ret.Get(2) != nil { r2 = ret.Get(2).([]float64) } } - - if rf, ok := ret.Get(3).(func([]model.MeasurementDescriptionDataType) error); ok { - r3 = rf(measDesc) + if returnFunc, ok := ret.Get(3).(func([]model.MeasurementDescriptionDataType) error); ok { + r3 = returnFunc(measDesc) } else { r3 = ret.Error(3) } - return r0, r1, r2, r3 } @@ -535,7 +589,13 @@ func (_e *ElectricalConnectionCommonInterface_Expecter) GetPhaseCurrentLimits(me func (_c *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call) Run(run func(measDesc []model.MeasurementDescriptionDataType)) *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]model.MeasurementDescriptionDataType)) + var arg0 []model.MeasurementDescriptionDataType + if args[0] != nil { + arg0 = args[0].([]model.MeasurementDescriptionDataType) + } + run( + arg0, + ) }) return _c } @@ -545,21 +605,7 @@ func (_c *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call) Return return _c } -func (_c *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call) RunAndReturn(run func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)) *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call { +func (_c *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call) RunAndReturn(run func(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)) *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call { _c.Call.Return(run) return _c } - -// NewElectricalConnectionCommonInterface creates a new instance of ElectricalConnectionCommonInterface. 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 NewElectricalConnectionCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *ElectricalConnectionCommonInterface { - mock := &ElectricalConnectionCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/ElectricalConnectionServerInterface.go b/mocks/ElectricalConnectionServerInterface.go index 4443bd8c..95420edd 100644 --- a/mocks/ElectricalConnectionServerInterface.go +++ b/mocks/ElectricalConnectionServerInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - api "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" - - model "github.com/enbility/spine-go/model" ) +// NewElectricalConnectionServerInterface creates a new instance of ElectricalConnectionServerInterface. 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 NewElectricalConnectionServerInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *ElectricalConnectionServerInterface { + mock := &ElectricalConnectionServerInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // ElectricalConnectionServerInterface is an autogenerated mock type for the ElectricalConnectionServerInterface type type ElectricalConnectionServerInterface struct { mock.Mock @@ -22,9 +37,9 @@ func (_m *ElectricalConnectionServerInterface) EXPECT() *ElectricalConnectionSer return &ElectricalConnectionServerInterface_Expecter{mock: &_m.Mock} } -// AddCharacteristic provides a mock function with given fields: data -func (_m *ElectricalConnectionServerInterface) AddCharacteristic(data model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error) { - ret := _m.Called(data) +// AddCharacteristic provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) AddCharacteristic(data model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error) { + ret := _mock.Called(data) if len(ret) == 0 { panic("no return value specified for AddCharacteristic") @@ -32,23 +47,21 @@ func (_m *ElectricalConnectionServerInterface) AddCharacteristic(data model.Elec var r0 *model.ElectricalConnectionCharacteristicIdType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error)); ok { - return rf(data) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error)); ok { + return returnFunc(data) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) *model.ElectricalConnectionCharacteristicIdType); ok { - r0 = rf(data) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) *model.ElectricalConnectionCharacteristicIdType); ok { + r0 = returnFunc(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.ElectricalConnectionCharacteristicIdType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { - r1 = rf(data) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { + r1 = returnFunc(data) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -65,36 +78,41 @@ func (_e *ElectricalConnectionServerInterface_Expecter) AddCharacteristic(data i func (_c *ElectricalConnectionServerInterface_AddCharacteristic_Call) Run(run func(data model.ElectricalConnectionCharacteristicDataType)) *ElectricalConnectionServerInterface_AddCharacteristic_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionCharacteristicDataType)) + var arg0 model.ElectricalConnectionCharacteristicDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionCharacteristicDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_AddCharacteristic_Call) Return(_a0 *model.ElectricalConnectionCharacteristicIdType, _a1 error) *ElectricalConnectionServerInterface_AddCharacteristic_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionServerInterface_AddCharacteristic_Call) Return(electricalConnectionCharacteristicIdType *model.ElectricalConnectionCharacteristicIdType, err error) *ElectricalConnectionServerInterface_AddCharacteristic_Call { + _c.Call.Return(electricalConnectionCharacteristicIdType, err) return _c } -func (_c *ElectricalConnectionServerInterface_AddCharacteristic_Call) RunAndReturn(run func(model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error)) *ElectricalConnectionServerInterface_AddCharacteristic_Call { +func (_c *ElectricalConnectionServerInterface_AddCharacteristic_Call) RunAndReturn(run func(data model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error)) *ElectricalConnectionServerInterface_AddCharacteristic_Call { _c.Call.Return(run) return _c } -// AddDescription provides a mock function with given fields: description -func (_m *ElectricalConnectionServerInterface) AddDescription(description model.ElectricalConnectionDescriptionDataType) error { - ret := _m.Called(description) +// AddDescription provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) AddDescription(description model.ElectricalConnectionDescriptionDataType) error { + ret := _mock.Called(description) if len(ret) == 0 { panic("no return value specified for AddDescription") } var r0 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) error); ok { - r0 = rf(description) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) error); ok { + r0 = returnFunc(description) } else { r0 = ret.Error(0) } - return r0 } @@ -111,38 +129,43 @@ func (_e *ElectricalConnectionServerInterface_Expecter) AddDescription(descripti func (_c *ElectricalConnectionServerInterface_AddDescription_Call) Run(run func(description model.ElectricalConnectionDescriptionDataType)) *ElectricalConnectionServerInterface_AddDescription_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionDescriptionDataType)) + var arg0 model.ElectricalConnectionDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_AddDescription_Call) Return(_a0 error) *ElectricalConnectionServerInterface_AddDescription_Call { - _c.Call.Return(_a0) +func (_c *ElectricalConnectionServerInterface_AddDescription_Call) Return(err error) *ElectricalConnectionServerInterface_AddDescription_Call { + _c.Call.Return(err) return _c } -func (_c *ElectricalConnectionServerInterface_AddDescription_Call) RunAndReturn(run func(model.ElectricalConnectionDescriptionDataType) error) *ElectricalConnectionServerInterface_AddDescription_Call { +func (_c *ElectricalConnectionServerInterface_AddDescription_Call) RunAndReturn(run func(description model.ElectricalConnectionDescriptionDataType) error) *ElectricalConnectionServerInterface_AddDescription_Call { _c.Call.Return(run) return _c } -// AddParameterDescription provides a mock function with given fields: description -func (_m *ElectricalConnectionServerInterface) AddParameterDescription(description model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType { - ret := _m.Called(description) +// AddParameterDescription provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) AddParameterDescription(description model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType { + ret := _mock.Called(description) if len(ret) == 0 { panic("no return value specified for AddParameterDescription") } var r0 *model.ElectricalConnectionParameterIdType - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType); ok { - r0 = rf(description) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType); ok { + r0 = returnFunc(description) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.ElectricalConnectionParameterIdType) } } - return r0 } @@ -159,36 +182,41 @@ func (_e *ElectricalConnectionServerInterface_Expecter) AddParameterDescription( func (_c *ElectricalConnectionServerInterface_AddParameterDescription_Call) Run(run func(description model.ElectricalConnectionParameterDescriptionDataType)) *ElectricalConnectionServerInterface_AddParameterDescription_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionParameterDescriptionDataType)) + var arg0 model.ElectricalConnectionParameterDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionParameterDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_AddParameterDescription_Call) Return(_a0 *model.ElectricalConnectionParameterIdType) *ElectricalConnectionServerInterface_AddParameterDescription_Call { - _c.Call.Return(_a0) +func (_c *ElectricalConnectionServerInterface_AddParameterDescription_Call) Return(electricalConnectionParameterIdType *model.ElectricalConnectionParameterIdType) *ElectricalConnectionServerInterface_AddParameterDescription_Call { + _c.Call.Return(electricalConnectionParameterIdType) return _c } -func (_c *ElectricalConnectionServerInterface_AddParameterDescription_Call) RunAndReturn(run func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType) *ElectricalConnectionServerInterface_AddParameterDescription_Call { +func (_c *ElectricalConnectionServerInterface_AddParameterDescription_Call) RunAndReturn(run func(description model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionParameterIdType) *ElectricalConnectionServerInterface_AddParameterDescription_Call { _c.Call.Return(run) return _c } -// AdjustValueToBeWithinPermittedValuesForParameterId provides a mock function with given fields: value, parameterId -func (_m *ElectricalConnectionServerInterface) AdjustValueToBeWithinPermittedValuesForParameterId(value float64, parameterId model.ElectricalConnectionParameterIdType) float64 { - ret := _m.Called(value, parameterId) +// AdjustValueToBeWithinPermittedValuesForParameterId provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) AdjustValueToBeWithinPermittedValuesForParameterId(value float64, parameterId model.ElectricalConnectionParameterIdType) float64 { + ret := _mock.Called(value, parameterId) if len(ret) == 0 { panic("no return value specified for AdjustValueToBeWithinPermittedValuesForParameterId") } var r0 float64 - if rf, ok := ret.Get(0).(func(float64, model.ElectricalConnectionParameterIdType) float64); ok { - r0 = rf(value, parameterId) + if returnFunc, ok := ret.Get(0).(func(float64, model.ElectricalConnectionParameterIdType) float64); ok { + r0 = returnFunc(value, parameterId) } else { r0 = ret.Get(0).(float64) } - return r0 } @@ -206,36 +234,46 @@ func (_e *ElectricalConnectionServerInterface_Expecter) AdjustValueToBeWithinPer func (_c *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Run(run func(value float64, parameterId model.ElectricalConnectionParameterIdType)) *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(model.ElectricalConnectionParameterIdType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 model.ElectricalConnectionParameterIdType + if args[1] != nil { + arg1 = args[1].(model.ElectricalConnectionParameterIdType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Return(_a0 float64) *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { - _c.Call.Return(_a0) +func (_c *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) Return(f float64) *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { + _c.Call.Return(f) return _c } -func (_c *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) RunAndReturn(run func(float64, model.ElectricalConnectionParameterIdType) float64) *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { +func (_c *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call) RunAndReturn(run func(value float64, parameterId model.ElectricalConnectionParameterIdType) float64) *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call { _c.Call.Return(run) return _c } -// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter -func (_m *ElectricalConnectionServerInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { - ret := _m.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { + ret := _mock.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { - r0 = rf(payloadData, filter) + if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { + r0 = returnFunc(payloadData, filter) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -245,32 +283,43 @@ type ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call str } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData interface{} -// - filter interface{} +// - payloadData any +// - filter any func (_e *ElectricalConnectionServerInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { return &ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { +func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(interface{}), args[1].(interface{})) + var arg0 any + if args[0] != nil { + arg0 = args[0].(any) + } + var arg1 any + if args[1] != nil { + arg1 = args[1].(any) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(_a0) +func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(b) return _c } -func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { +func (_c *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetCharacteristicsForFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionServerInterface) GetCharacteristicsForFilter(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error) { - ret := _m.Called(filter) +// GetCharacteristicsForFilter provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) GetCharacteristicsForFilter(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetCharacteristicsForFilter") @@ -278,23 +327,21 @@ func (_m *ElectricalConnectionServerInterface) GetCharacteristicsForFilter(filte var r0 []model.ElectricalConnectionCharacteristicDataType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) []model.ElectricalConnectionCharacteristicDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) []model.ElectricalConnectionCharacteristicDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionCharacteristicDataType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -311,24 +358,30 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetCharacteristicsForFil func (_c *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call) Run(run func(filter model.ElectricalConnectionCharacteristicDataType)) *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionCharacteristicDataType)) + var arg0 model.ElectricalConnectionCharacteristicDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionCharacteristicDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call) Return(_a0 []model.ElectricalConnectionCharacteristicDataType, _a1 error) *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call) Return(electricalConnectionCharacteristicDataTypes []model.ElectricalConnectionCharacteristicDataType, err error) *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call { + _c.Call.Return(electricalConnectionCharacteristicDataTypes, err) return _c } -func (_c *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)) *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)) *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call { _c.Call.Return(run) return _c } -// GetDescriptionForParameterDescriptionFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionServerInterface) GetDescriptionForParameterDescriptionFilter(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error) { - ret := _m.Called(filter) +// GetDescriptionForParameterDescriptionFilter provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) GetDescriptionForParameterDescriptionFilter(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionForParameterDescriptionFilter") @@ -336,23 +389,21 @@ func (_m *ElectricalConnectionServerInterface) GetDescriptionForParameterDescrip var r0 *model.ElectricalConnectionDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) *model.ElectricalConnectionDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.ElectricalConnectionDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -369,24 +420,30 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetDescriptionForParamet func (_c *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call) Run(run func(filter model.ElectricalConnectionParameterDescriptionDataType)) *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionParameterDescriptionDataType)) + var arg0 model.ElectricalConnectionParameterDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionParameterDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call) Return(_a0 *model.ElectricalConnectionDescriptionDataType, _a1 error) *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call) Return(electricalConnectionDescriptionDataType *model.ElectricalConnectionDescriptionDataType, err error) *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call { + _c.Call.Return(electricalConnectionDescriptionDataType, err) return _c } -func (_c *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call) RunAndReturn(run func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call { _c.Call.Return(run) return _c } -// GetDescriptionsForFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionServerInterface) GetDescriptionsForFilter(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error) { - ret := _m.Called(filter) +// GetDescriptionsForFilter provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) GetDescriptionsForFilter(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionsForFilter") @@ -394,23 +451,21 @@ func (_m *ElectricalConnectionServerInterface) GetDescriptionsForFilter(filter m var r0 []model.ElectricalConnectionDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) []model.ElectricalConnectionDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) []model.ElectricalConnectionDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -427,24 +482,30 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetDescriptionsForFilter func (_c *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call) Run(run func(filter model.ElectricalConnectionDescriptionDataType)) *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionDescriptionDataType)) + var arg0 model.ElectricalConnectionDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call) Return(_a0 []model.ElectricalConnectionDescriptionDataType, _a1 error) *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call) Return(electricalConnectionDescriptionDataTypes []model.ElectricalConnectionDescriptionDataType, err error) *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call { + _c.Call.Return(electricalConnectionDescriptionDataTypes, err) return _c } -func (_c *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call { _c.Call.Return(run) return _c } -// GetOrAddIdForDescription provides a mock function with given fields: electricalConnectionDescription -func (_m *ElectricalConnectionServerInterface) GetOrAddIdForDescription(electricalConnectionDescription model.ElectricalConnectionDescriptionDataType) (*model.ElectricalConnectionIdType, error) { - ret := _m.Called(electricalConnectionDescription) +// GetOrAddIdForDescription provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) GetOrAddIdForDescription(electricalConnectionDescription model.ElectricalConnectionDescriptionDataType) (*model.ElectricalConnectionIdType, error) { + ret := _mock.Called(electricalConnectionDescription) if len(ret) == 0 { panic("no return value specified for GetOrAddIdForDescription") @@ -452,23 +513,21 @@ func (_m *ElectricalConnectionServerInterface) GetOrAddIdForDescription(electric var r0 *model.ElectricalConnectionIdType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) (*model.ElectricalConnectionIdType, error)); ok { - return rf(electricalConnectionDescription) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) (*model.ElectricalConnectionIdType, error)); ok { + return returnFunc(electricalConnectionDescription) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) *model.ElectricalConnectionIdType); ok { - r0 = rf(electricalConnectionDescription) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) *model.ElectricalConnectionIdType); ok { + r0 = returnFunc(electricalConnectionDescription) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.ElectricalConnectionIdType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok { - r1 = rf(electricalConnectionDescription) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok { + r1 = returnFunc(electricalConnectionDescription) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -485,24 +544,30 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetOrAddIdForDescription func (_c *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call) Run(run func(electricalConnectionDescription model.ElectricalConnectionDescriptionDataType)) *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionDescriptionDataType)) + var arg0 model.ElectricalConnectionDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call) Return(_a0 *model.ElectricalConnectionIdType, _a1 error) *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call) Return(electricalConnectionIdType *model.ElectricalConnectionIdType, err error) *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call { + _c.Call.Return(electricalConnectionIdType, err) return _c } -func (_c *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call) RunAndReturn(run func(model.ElectricalConnectionDescriptionDataType) (*model.ElectricalConnectionIdType, error)) *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call { +func (_c *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call) RunAndReturn(run func(electricalConnectionDescription model.ElectricalConnectionDescriptionDataType) (*model.ElectricalConnectionIdType, error)) *ElectricalConnectionServerInterface_GetOrAddIdForDescription_Call { _c.Call.Return(run) return _c } -// GetParameterDescriptionsForFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionServerInterface) GetParameterDescriptionsForFilter(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error) { - ret := _m.Called(filter) +// GetParameterDescriptionsForFilter provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) GetParameterDescriptionsForFilter(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetParameterDescriptionsForFilter") @@ -510,23 +575,21 @@ func (_m *ElectricalConnectionServerInterface) GetParameterDescriptionsForFilter var r0 []model.ElectricalConnectionParameterDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) []model.ElectricalConnectionParameterDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) []model.ElectricalConnectionParameterDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionParameterDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -543,24 +606,30 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetParameterDescriptions func (_c *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call) Run(run func(filter model.ElectricalConnectionParameterDescriptionDataType)) *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionParameterDescriptionDataType)) + var arg0 model.ElectricalConnectionParameterDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionParameterDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call) Return(_a0 []model.ElectricalConnectionParameterDescriptionDataType, _a1 error) *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call) Return(electricalConnectionParameterDescriptionDataTypes []model.ElectricalConnectionParameterDescriptionDataType, err error) *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call { + _c.Call.Return(electricalConnectionParameterDescriptionDataTypes, err) return _c } -func (_c *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)) *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call { _c.Call.Return(run) return _c } -// GetPermittedValueDataForFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionServerInterface) GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error) { - ret := _m.Called(filter) +// GetPermittedValueDataForFilter provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetPermittedValueDataForFilter") @@ -570,33 +639,29 @@ func (_m *ElectricalConnectionServerInterface) GetPermittedValueDataForFilter(fi var r1 float64 var r2 float64 var r3 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r0 = returnFunc(filter) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r1 = returnFunc(filter) } else { r1 = ret.Get(1).(float64) } - - if rf, ok := ret.Get(2).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { - r2 = rf(filter) + if returnFunc, ok := ret.Get(2).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok { + r2 = returnFunc(filter) } else { r2 = ret.Get(2).(float64) } - - if rf, ok := ret.Get(3).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { - r3 = rf(filter) + if returnFunc, ok := ret.Get(3).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { + r3 = returnFunc(filter) } else { r3 = ret.Error(3) } - return r0, r1, r2, r3 } @@ -613,24 +678,30 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetPermittedValueDataFor func (_c *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call) Run(run func(filter model.ElectricalConnectionPermittedValueSetDataType)) *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionPermittedValueSetDataType)) + var arg0 model.ElectricalConnectionPermittedValueSetDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionPermittedValueSetDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call) Return(_a0 float64, _a1 float64, _a2 float64, _a3 error) *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call { - _c.Call.Return(_a0, _a1, _a2, _a3) +func (_c *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call) Return(f float64, f1 float64, f2 float64, err error) *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call { + _c.Call.Return(f, f1, f2, err) return _c } -func (_c *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)) *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionPermittedValueSetDataType) (float64, float64, float64, error)) *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call { _c.Call.Return(run) return _c } -// GetPermittedValueSetForFilter provides a mock function with given fields: filter -func (_m *ElectricalConnectionServerInterface) GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error) { - ret := _m.Called(filter) +// GetPermittedValueSetForFilter provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetPermittedValueSetForFilter") @@ -638,23 +709,21 @@ func (_m *ElectricalConnectionServerInterface) GetPermittedValueSetForFilter(fil var r0 []model.ElectricalConnectionPermittedValueSetDataType var r1 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) []model.ElectricalConnectionPermittedValueSetDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) []model.ElectricalConnectionPermittedValueSetDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.ElectricalConnectionPermittedValueSetDataType) } } - - if rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -671,24 +740,30 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetPermittedValueSetForF func (_c *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call) Run(run func(filter model.ElectricalConnectionPermittedValueSetDataType)) *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionPermittedValueSetDataType)) + var arg0 model.ElectricalConnectionPermittedValueSetDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionPermittedValueSetDataType) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call) Return(_a0 []model.ElectricalConnectionPermittedValueSetDataType, _a1 error) *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call) Return(electricalConnectionPermittedValueSetDataTypes []model.ElectricalConnectionPermittedValueSetDataType, err error) *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call { + _c.Call.Return(electricalConnectionPermittedValueSetDataTypes, err) return _c } -func (_c *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call) RunAndReturn(run func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)) *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call { +func (_c *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call) RunAndReturn(run func(filter model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)) *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call { _c.Call.Return(run) return _c } -// GetPhaseCurrentLimits provides a mock function with given fields: measDesc -func (_m *ElectricalConnectionServerInterface) GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error) { - ret := _m.Called(measDesc) +// GetPhaseCurrentLimits provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error) { + ret := _mock.Called(measDesc) if len(ret) == 0 { panic("no return value specified for GetPhaseCurrentLimits") @@ -698,39 +773,35 @@ func (_m *ElectricalConnectionServerInterface) GetPhaseCurrentLimits(measDesc [] var r1 []float64 var r2 []float64 var r3 error - if rf, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)); ok { - return rf(measDesc) + if returnFunc, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)); ok { + return returnFunc(measDesc) } - if rf, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r0 = rf(measDesc) + if returnFunc, ok := ret.Get(0).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r0 = returnFunc(measDesc) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r1 = rf(measDesc) + if returnFunc, ok := ret.Get(1).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r1 = returnFunc(measDesc) } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]float64) } } - - if rf, ok := ret.Get(2).(func([]model.MeasurementDescriptionDataType) []float64); ok { - r2 = rf(measDesc) + if returnFunc, ok := ret.Get(2).(func([]model.MeasurementDescriptionDataType) []float64); ok { + r2 = returnFunc(measDesc) } else { if ret.Get(2) != nil { r2 = ret.Get(2).([]float64) } } - - if rf, ok := ret.Get(3).(func([]model.MeasurementDescriptionDataType) error); ok { - r3 = rf(measDesc) + if returnFunc, ok := ret.Get(3).(func([]model.MeasurementDescriptionDataType) error); ok { + r3 = returnFunc(measDesc) } else { r3 = ret.Error(3) } - return r0, r1, r2, r3 } @@ -747,7 +818,13 @@ func (_e *ElectricalConnectionServerInterface_Expecter) GetPhaseCurrentLimits(me func (_c *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call) Run(run func(measDesc []model.MeasurementDescriptionDataType)) *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]model.MeasurementDescriptionDataType)) + var arg0 []model.MeasurementDescriptionDataType + if args[0] != nil { + arg0 = args[0].([]model.MeasurementDescriptionDataType) + } + run( + arg0, + ) }) return _c } @@ -757,26 +834,25 @@ func (_c *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call) Return return _c } -func (_c *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call) RunAndReturn(run func([]model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)) *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call { +func (_c *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call) RunAndReturn(run func(measDesc []model.MeasurementDescriptionDataType) ([]float64, []float64, []float64, error)) *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call { _c.Call.Return(run) return _c } -// UpdateCharacteristic provides a mock function with given fields: data, deleteElements -func (_m *ElectricalConnectionServerInterface) UpdateCharacteristic(data model.ElectricalConnectionCharacteristicDataType, deleteElements *model.ElectricalConnectionCharacteristicDataElementsType) error { - ret := _m.Called(data, deleteElements) +// UpdateCharacteristic provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) UpdateCharacteristic(data model.ElectricalConnectionCharacteristicDataType, deleteElements *model.ElectricalConnectionCharacteristicDataElementsType) error { + ret := _mock.Called(data, deleteElements) if len(ret) == 0 { panic("no return value specified for UpdateCharacteristic") } var r0 error - if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType, *model.ElectricalConnectionCharacteristicDataElementsType) error); ok { - r0 = rf(data, deleteElements) + if returnFunc, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType, *model.ElectricalConnectionCharacteristicDataElementsType) error); ok { + r0 = returnFunc(data, deleteElements) } else { r0 = ret.Error(0) } - return r0 } @@ -794,36 +870,46 @@ func (_e *ElectricalConnectionServerInterface_Expecter) UpdateCharacteristic(dat func (_c *ElectricalConnectionServerInterface_UpdateCharacteristic_Call) Run(run func(data model.ElectricalConnectionCharacteristicDataType, deleteElements *model.ElectricalConnectionCharacteristicDataElementsType)) *ElectricalConnectionServerInterface_UpdateCharacteristic_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.ElectricalConnectionCharacteristicDataType), args[1].(*model.ElectricalConnectionCharacteristicDataElementsType)) + var arg0 model.ElectricalConnectionCharacteristicDataType + if args[0] != nil { + arg0 = args[0].(model.ElectricalConnectionCharacteristicDataType) + } + var arg1 *model.ElectricalConnectionCharacteristicDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.ElectricalConnectionCharacteristicDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_UpdateCharacteristic_Call) Return(_a0 error) *ElectricalConnectionServerInterface_UpdateCharacteristic_Call { - _c.Call.Return(_a0) +func (_c *ElectricalConnectionServerInterface_UpdateCharacteristic_Call) Return(err error) *ElectricalConnectionServerInterface_UpdateCharacteristic_Call { + _c.Call.Return(err) return _c } -func (_c *ElectricalConnectionServerInterface_UpdateCharacteristic_Call) RunAndReturn(run func(model.ElectricalConnectionCharacteristicDataType, *model.ElectricalConnectionCharacteristicDataElementsType) error) *ElectricalConnectionServerInterface_UpdateCharacteristic_Call { +func (_c *ElectricalConnectionServerInterface_UpdateCharacteristic_Call) RunAndReturn(run func(data model.ElectricalConnectionCharacteristicDataType, deleteElements *model.ElectricalConnectionCharacteristicDataElementsType) error) *ElectricalConnectionServerInterface_UpdateCharacteristic_Call { _c.Call.Return(run) return _c } -// UpdatePermittedValueSetForFilters provides a mock function with given fields: data, deleteSelector, deleteElements -func (_m *ElectricalConnectionServerInterface) UpdatePermittedValueSetForFilters(data []api.ElectricalConnectionPermittedValueSetForFilter, deleteSelector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, deleteElements *model.ElectricalConnectionPermittedValueSetDataElementsType) error { - ret := _m.Called(data, deleteSelector, deleteElements) +// UpdatePermittedValueSetForFilters provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) UpdatePermittedValueSetForFilters(data []api.ElectricalConnectionPermittedValueSetForFilter, deleteSelector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, deleteElements *model.ElectricalConnectionPermittedValueSetDataElementsType) error { + ret := _mock.Called(data, deleteSelector, deleteElements) if len(ret) == 0 { panic("no return value specified for UpdatePermittedValueSetForFilters") } var r0 error - if rf, ok := ret.Get(0).(func([]api.ElectricalConnectionPermittedValueSetForFilter, *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) error); ok { - r0 = rf(data, deleteSelector, deleteElements) + if returnFunc, ok := ret.Get(0).(func([]api.ElectricalConnectionPermittedValueSetForFilter, *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) error); ok { + r0 = returnFunc(data, deleteSelector, deleteElements) } else { r0 = ret.Error(0) } - return r0 } @@ -842,36 +928,51 @@ func (_e *ElectricalConnectionServerInterface_Expecter) UpdatePermittedValueSetF func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call) Run(run func(data []api.ElectricalConnectionPermittedValueSetForFilter, deleteSelector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, deleteElements *model.ElectricalConnectionPermittedValueSetDataElementsType)) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]api.ElectricalConnectionPermittedValueSetForFilter), args[1].(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType), args[2].(*model.ElectricalConnectionPermittedValueSetDataElementsType)) + var arg0 []api.ElectricalConnectionPermittedValueSetForFilter + if args[0] != nil { + arg0 = args[0].([]api.ElectricalConnectionPermittedValueSetForFilter) + } + var arg1 *model.ElectricalConnectionPermittedValueSetListDataSelectorsType + if args[1] != nil { + arg1 = args[1].(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType) + } + var arg2 *model.ElectricalConnectionPermittedValueSetDataElementsType + if args[2] != nil { + arg2 = args[2].(*model.ElectricalConnectionPermittedValueSetDataElementsType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call) Return(_a0 error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call { - _c.Call.Return(_a0) +func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call) Return(err error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call { + _c.Call.Return(err) return _c } -func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call) RunAndReturn(run func([]api.ElectricalConnectionPermittedValueSetForFilter, *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call { +func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call) RunAndReturn(run func(data []api.ElectricalConnectionPermittedValueSetForFilter, deleteSelector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType, deleteElements *model.ElectricalConnectionPermittedValueSetDataElementsType) error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForFilters_Call { _c.Call.Return(run) return _c } -// UpdatePermittedValueSetForIds provides a mock function with given fields: data -func (_m *ElectricalConnectionServerInterface) UpdatePermittedValueSetForIds(data []api.ElectricalConnectionPermittedValueSetForID) error { - ret := _m.Called(data) +// UpdatePermittedValueSetForIds provides a mock function for the type ElectricalConnectionServerInterface +func (_mock *ElectricalConnectionServerInterface) UpdatePermittedValueSetForIds(data []api.ElectricalConnectionPermittedValueSetForID) error { + ret := _mock.Called(data) if len(ret) == 0 { panic("no return value specified for UpdatePermittedValueSetForIds") } var r0 error - if rf, ok := ret.Get(0).(func([]api.ElectricalConnectionPermittedValueSetForID) error); ok { - r0 = rf(data) + if returnFunc, ok := ret.Get(0).(func([]api.ElectricalConnectionPermittedValueSetForID) error); ok { + r0 = returnFunc(data) } else { r0 = ret.Error(0) } - return r0 } @@ -888,31 +989,23 @@ func (_e *ElectricalConnectionServerInterface_Expecter) UpdatePermittedValueSetF func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call) Run(run func(data []api.ElectricalConnectionPermittedValueSetForID)) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]api.ElectricalConnectionPermittedValueSetForID)) + var arg0 []api.ElectricalConnectionPermittedValueSetForID + if args[0] != nil { + arg0 = args[0].([]api.ElectricalConnectionPermittedValueSetForID) + } + run( + arg0, + ) }) return _c } -func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call) Return(_a0 error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call { - _c.Call.Return(_a0) +func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call) Return(err error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call { + _c.Call.Return(err) return _c } -func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call) RunAndReturn(run func([]api.ElectricalConnectionPermittedValueSetForID) error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call { +func (_c *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call) RunAndReturn(run func(data []api.ElectricalConnectionPermittedValueSetForID) error) *ElectricalConnectionServerInterface_UpdatePermittedValueSetForIds_Call { _c.Call.Return(run) return _c } - -// NewElectricalConnectionServerInterface creates a new instance of ElectricalConnectionServerInterface. 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 NewElectricalConnectionServerInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *ElectricalConnectionServerInterface { - mock := &ElectricalConnectionServerInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/FeatureClientInterface.go b/mocks/FeatureClientInterface.go index c6bc5ba7..dac163c1 100644 --- a/mocks/FeatureClientInterface.go +++ b/mocks/FeatureClientInterface.go @@ -1,15 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - api "github.com/enbility/spine-go/api" - + "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" - - model "github.com/enbility/spine-go/model" ) +// NewFeatureClientInterface creates a new instance of FeatureClientInterface. 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 NewFeatureClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *FeatureClientInterface { + mock := &FeatureClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // FeatureClientInterface is an autogenerated mock type for the FeatureClientInterface type type FeatureClientInterface struct { mock.Mock @@ -23,21 +37,20 @@ func (_m *FeatureClientInterface) EXPECT() *FeatureClientInterface_Expecter { return &FeatureClientInterface_Expecter{mock: &_m.Mock} } -// AddResponseCallback provides a mock function with given fields: msgCounterReference, function -func (_m *FeatureClientInterface) AddResponseCallback(msgCounterReference model.MsgCounterType, function func(api.ResponseMessage)) error { - ret := _m.Called(msgCounterReference, function) +// AddResponseCallback provides a mock function for the type FeatureClientInterface +func (_mock *FeatureClientInterface) AddResponseCallback(msgCounterReference model.MsgCounterType, function func(msg api.ResponseMessage)) error { + ret := _mock.Called(msgCounterReference, function) if len(ret) == 0 { panic("no return value specified for AddResponseCallback") } var r0 error - if rf, ok := ret.Get(0).(func(model.MsgCounterType, func(api.ResponseMessage)) error); ok { - r0 = rf(msgCounterReference, function) + if returnFunc, ok := ret.Get(0).(func(model.MsgCounterType, func(msg api.ResponseMessage)) error); ok { + r0 = returnFunc(msgCounterReference, function) } else { r0 = ret.Error(0) } - return r0 } @@ -48,31 +61,43 @@ type FeatureClientInterface_AddResponseCallback_Call struct { // AddResponseCallback is a helper method to define mock.On call // - msgCounterReference model.MsgCounterType -// - function func(api.ResponseMessage) +// - function func(msg api.ResponseMessage) func (_e *FeatureClientInterface_Expecter) AddResponseCallback(msgCounterReference interface{}, function interface{}) *FeatureClientInterface_AddResponseCallback_Call { return &FeatureClientInterface_AddResponseCallback_Call{Call: _e.mock.On("AddResponseCallback", msgCounterReference, function)} } -func (_c *FeatureClientInterface_AddResponseCallback_Call) Run(run func(msgCounterReference model.MsgCounterType, function func(api.ResponseMessage))) *FeatureClientInterface_AddResponseCallback_Call { +func (_c *FeatureClientInterface_AddResponseCallback_Call) Run(run func(msgCounterReference model.MsgCounterType, function func(msg api.ResponseMessage))) *FeatureClientInterface_AddResponseCallback_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.MsgCounterType), args[1].(func(api.ResponseMessage))) + var arg0 model.MsgCounterType + if args[0] != nil { + arg0 = args[0].(model.MsgCounterType) + } + var arg1 func(msg api.ResponseMessage) + if args[1] != nil { + arg1 = args[1].(func(msg api.ResponseMessage)) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *FeatureClientInterface_AddResponseCallback_Call) Return(_a0 error) *FeatureClientInterface_AddResponseCallback_Call { - _c.Call.Return(_a0) +func (_c *FeatureClientInterface_AddResponseCallback_Call) Return(err error) *FeatureClientInterface_AddResponseCallback_Call { + _c.Call.Return(err) return _c } -func (_c *FeatureClientInterface_AddResponseCallback_Call) RunAndReturn(run func(model.MsgCounterType, func(api.ResponseMessage)) error) *FeatureClientInterface_AddResponseCallback_Call { +func (_c *FeatureClientInterface_AddResponseCallback_Call) RunAndReturn(run func(msgCounterReference model.MsgCounterType, function func(msg api.ResponseMessage)) error) *FeatureClientInterface_AddResponseCallback_Call { _c.Call.Return(run) return _c } -// AddResultCallback provides a mock function with given fields: function -func (_m *FeatureClientInterface) AddResultCallback(function func(api.ResponseMessage)) { - _m.Called(function) +// AddResultCallback provides a mock function for the type FeatureClientInterface +func (_mock *FeatureClientInterface) AddResultCallback(function func(msg api.ResponseMessage)) { + _mock.Called(function) + return } // FeatureClientInterface_AddResultCallback_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddResultCallback' @@ -81,14 +106,20 @@ type FeatureClientInterface_AddResultCallback_Call struct { } // AddResultCallback is a helper method to define mock.On call -// - function func(api.ResponseMessage) +// - function func(msg api.ResponseMessage) func (_e *FeatureClientInterface_Expecter) AddResultCallback(function interface{}) *FeatureClientInterface_AddResultCallback_Call { return &FeatureClientInterface_AddResultCallback_Call{Call: _e.mock.On("AddResultCallback", function)} } -func (_c *FeatureClientInterface_AddResultCallback_Call) Run(run func(function func(api.ResponseMessage))) *FeatureClientInterface_AddResultCallback_Call { +func (_c *FeatureClientInterface_AddResultCallback_Call) Run(run func(function func(msg api.ResponseMessage))) *FeatureClientInterface_AddResultCallback_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(func(api.ResponseMessage))) + var arg0 func(msg api.ResponseMessage) + if args[0] != nil { + arg0 = args[0].(func(msg api.ResponseMessage)) + } + run( + arg0, + ) }) return _c } @@ -98,14 +129,14 @@ func (_c *FeatureClientInterface_AddResultCallback_Call) Return() *FeatureClient return _c } -func (_c *FeatureClientInterface_AddResultCallback_Call) RunAndReturn(run func(func(api.ResponseMessage))) *FeatureClientInterface_AddResultCallback_Call { +func (_c *FeatureClientInterface_AddResultCallback_Call) RunAndReturn(run func(function func(msg api.ResponseMessage))) *FeatureClientInterface_AddResultCallback_Call { _c.Run(run) return _c } -// Bind provides a mock function with no fields -func (_m *FeatureClientInterface) Bind() (*model.MsgCounterType, error) { - ret := _m.Called() +// Bind provides a mock function for the type FeatureClientInterface +func (_mock *FeatureClientInterface) Bind() (*model.MsgCounterType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Bind") @@ -113,23 +144,21 @@ func (_m *FeatureClientInterface) Bind() (*model.MsgCounterType, error) { var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -150,8 +179,8 @@ func (_c *FeatureClientInterface_Bind_Call) Run(run func()) *FeatureClientInterf return _c } -func (_c *FeatureClientInterface_Bind_Call) Return(_a0 *model.MsgCounterType, _a1 error) *FeatureClientInterface_Bind_Call { - _c.Call.Return(_a0, _a1) +func (_c *FeatureClientInterface_Bind_Call) Return(msgCounterType *model.MsgCounterType, err error) *FeatureClientInterface_Bind_Call { + _c.Call.Return(msgCounterType, err) return _c } @@ -160,21 +189,20 @@ func (_c *FeatureClientInterface_Bind_Call) RunAndReturn(run func() (*model.MsgC return _c } -// HasBinding provides a mock function with no fields -func (_m *FeatureClientInterface) HasBinding() bool { - ret := _m.Called() +// HasBinding provides a mock function for the type FeatureClientInterface +func (_mock *FeatureClientInterface) HasBinding() bool { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for HasBinding") } var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -195,8 +223,8 @@ func (_c *FeatureClientInterface_HasBinding_Call) Run(run func()) *FeatureClient return _c } -func (_c *FeatureClientInterface_HasBinding_Call) Return(_a0 bool) *FeatureClientInterface_HasBinding_Call { - _c.Call.Return(_a0) +func (_c *FeatureClientInterface_HasBinding_Call) Return(b bool) *FeatureClientInterface_HasBinding_Call { + _c.Call.Return(b) return _c } @@ -205,21 +233,20 @@ func (_c *FeatureClientInterface_HasBinding_Call) RunAndReturn(run func() bool) return _c } -// HasSubscription provides a mock function with no fields -func (_m *FeatureClientInterface) HasSubscription() bool { - ret := _m.Called() +// HasSubscription provides a mock function for the type FeatureClientInterface +func (_mock *FeatureClientInterface) HasSubscription() bool { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for HasSubscription") } var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -240,8 +267,8 @@ func (_c *FeatureClientInterface_HasSubscription_Call) Run(run func()) *FeatureC return _c } -func (_c *FeatureClientInterface_HasSubscription_Call) Return(_a0 bool) *FeatureClientInterface_HasSubscription_Call { - _c.Call.Return(_a0) +func (_c *FeatureClientInterface_HasSubscription_Call) Return(b bool) *FeatureClientInterface_HasSubscription_Call { + _c.Call.Return(b) return _c } @@ -250,9 +277,9 @@ func (_c *FeatureClientInterface_HasSubscription_Call) RunAndReturn(run func() b return _c } -// Subscribe provides a mock function with no fields -func (_m *FeatureClientInterface) Subscribe() (*model.MsgCounterType, error) { - ret := _m.Called() +// Subscribe provides a mock function for the type FeatureClientInterface +func (_mock *FeatureClientInterface) Subscribe() (*model.MsgCounterType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Subscribe") @@ -260,23 +287,21 @@ func (_m *FeatureClientInterface) Subscribe() (*model.MsgCounterType, error) { var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -297,8 +322,8 @@ func (_c *FeatureClientInterface_Subscribe_Call) Run(run func()) *FeatureClientI return _c } -func (_c *FeatureClientInterface_Subscribe_Call) Return(_a0 *model.MsgCounterType, _a1 error) *FeatureClientInterface_Subscribe_Call { - _c.Call.Return(_a0, _a1) +func (_c *FeatureClientInterface_Subscribe_Call) Return(msgCounterType *model.MsgCounterType, err error) *FeatureClientInterface_Subscribe_Call { + _c.Call.Return(msgCounterType, err) return _c } @@ -306,17 +331,3 @@ func (_c *FeatureClientInterface_Subscribe_Call) RunAndReturn(run func() (*model _c.Call.Return(run) return _c } - -// NewFeatureClientInterface creates a new instance of FeatureClientInterface. 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 NewFeatureClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *FeatureClientInterface { - mock := &FeatureClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/FeatureServerInterface.go b/mocks/FeatureServerInterface.go index fe726d65..2698e67d 100644 --- a/mocks/FeatureServerInterface.go +++ b/mocks/FeatureServerInterface.go @@ -1,21 +1,12 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks -import mock "github.com/stretchr/testify/mock" - -// FeatureServerInterface is an autogenerated mock type for the FeatureServerInterface type -type FeatureServerInterface struct { - mock.Mock -} - -type FeatureServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *FeatureServerInterface) EXPECT() *FeatureServerInterface_Expecter { - return &FeatureServerInterface_Expecter{mock: &_m.Mock} -} +import ( + mock "github.com/stretchr/testify/mock" +) // NewFeatureServerInterface creates a new instance of FeatureServerInterface. 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. @@ -30,3 +21,16 @@ func NewFeatureServerInterface(t interface { return mock } + +// FeatureServerInterface is an autogenerated mock type for the FeatureServerInterface type +type FeatureServerInterface struct { + mock.Mock +} + +type FeatureServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *FeatureServerInterface) EXPECT() *FeatureServerInterface_Expecter { + return &FeatureServerInterface_Expecter{mock: &_m.Mock} +} diff --git a/mocks/IdentificationClientInterface.go b/mocks/IdentificationClientInterface.go index e63f3fc9..03182d03 100644 --- a/mocks/IdentificationClientInterface.go +++ b/mocks/IdentificationClientInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewIdentificationClientInterface creates a new instance of IdentificationClientInterface. 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 NewIdentificationClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *IdentificationClientInterface { + mock := &IdentificationClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // IdentificationClientInterface is an autogenerated mock type for the IdentificationClientInterface type type IdentificationClientInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *IdentificationClientInterface) EXPECT() *IdentificationClientInterface return &IdentificationClientInterface_Expecter{mock: &_m.Mock} } -// RequestValues provides a mock function with no fields -func (_m *IdentificationClientInterface) RequestValues() (*model.MsgCounterType, error) { - ret := _m.Called() +// RequestValues provides a mock function for the type IdentificationClientInterface +func (_mock *IdentificationClientInterface) RequestValues() (*model.MsgCounterType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RequestValues") @@ -30,23 +46,21 @@ func (_m *IdentificationClientInterface) RequestValues() (*model.MsgCounterType, var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -67,8 +81,8 @@ func (_c *IdentificationClientInterface_RequestValues_Call) Run(run func()) *Ide return _c } -func (_c *IdentificationClientInterface_RequestValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IdentificationClientInterface_RequestValues_Call { - _c.Call.Return(_a0, _a1) +func (_c *IdentificationClientInterface_RequestValues_Call) Return(msgCounterType *model.MsgCounterType, err error) *IdentificationClientInterface_RequestValues_Call { + _c.Call.Return(msgCounterType, err) return _c } @@ -76,17 +90,3 @@ func (_c *IdentificationClientInterface_RequestValues_Call) RunAndReturn(run fun _c.Call.Return(run) return _c } - -// NewIdentificationClientInterface creates a new instance of IdentificationClientInterface. 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 NewIdentificationClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *IdentificationClientInterface { - mock := &IdentificationClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/IdentificationCommonInterface.go b/mocks/IdentificationCommonInterface.go index 7332ca28..b2299ff6 100644 --- a/mocks/IdentificationCommonInterface.go +++ b/mocks/IdentificationCommonInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewIdentificationCommonInterface creates a new instance of IdentificationCommonInterface. 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 NewIdentificationCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *IdentificationCommonInterface { + mock := &IdentificationCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // IdentificationCommonInterface is an autogenerated mock type for the IdentificationCommonInterface type type IdentificationCommonInterface struct { mock.Mock @@ -20,21 +36,20 @@ func (_m *IdentificationCommonInterface) EXPECT() *IdentificationCommonInterface return &IdentificationCommonInterface_Expecter{mock: &_m.Mock} } -// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData -func (_m *IdentificationCommonInterface) CheckEventPayloadDataForFilter(payloadData interface{}) bool { - ret := _m.Called(payloadData) +// CheckEventPayloadDataForFilter provides a mock function for the type IdentificationCommonInterface +func (_mock *IdentificationCommonInterface) CheckEventPayloadDataForFilter(payloadData any) bool { + ret := _mock.Called(payloadData) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if rf, ok := ret.Get(0).(func(interface{}) bool); ok { - r0 = rf(payloadData) + if returnFunc, ok := ret.Get(0).(func(any) bool); ok { + r0 = returnFunc(payloadData) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -44,31 +59,37 @@ type IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call struct { } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData interface{} +// - payloadData any func (_e *IdentificationCommonInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { return &IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData)} } -func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{})) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any)) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(interface{})) + var arg0 any + if args[0] != nil { + arg0 = args[0].(any) + } + run( + arg0, + ) }) return _c } -func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(_a0) +func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(b) return _c } -func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}) bool) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any) bool) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetDataForFilter provides a mock function with given fields: filter -func (_m *IdentificationCommonInterface) GetDataForFilter(filter model.IdentificationDataType) ([]model.IdentificationDataType, error) { - ret := _m.Called(filter) +// GetDataForFilter provides a mock function for the type IdentificationCommonInterface +func (_mock *IdentificationCommonInterface) GetDataForFilter(filter model.IdentificationDataType) ([]model.IdentificationDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDataForFilter") @@ -76,23 +97,21 @@ func (_m *IdentificationCommonInterface) GetDataForFilter(filter model.Identific var r0 []model.IdentificationDataType var r1 error - if rf, ok := ret.Get(0).(func(model.IdentificationDataType) ([]model.IdentificationDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.IdentificationDataType) ([]model.IdentificationDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.IdentificationDataType) []model.IdentificationDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.IdentificationDataType) []model.IdentificationDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.IdentificationDataType) } } - - if rf, ok := ret.Get(1).(func(model.IdentificationDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.IdentificationDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -109,31 +128,23 @@ func (_e *IdentificationCommonInterface_Expecter) GetDataForFilter(filter interf func (_c *IdentificationCommonInterface_GetDataForFilter_Call) Run(run func(filter model.IdentificationDataType)) *IdentificationCommonInterface_GetDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.IdentificationDataType)) + var arg0 model.IdentificationDataType + if args[0] != nil { + arg0 = args[0].(model.IdentificationDataType) + } + run( + arg0, + ) }) return _c } -func (_c *IdentificationCommonInterface_GetDataForFilter_Call) Return(_a0 []model.IdentificationDataType, _a1 error) *IdentificationCommonInterface_GetDataForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *IdentificationCommonInterface_GetDataForFilter_Call) Return(identificationDataTypes []model.IdentificationDataType, err error) *IdentificationCommonInterface_GetDataForFilter_Call { + _c.Call.Return(identificationDataTypes, err) return _c } -func (_c *IdentificationCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(model.IdentificationDataType) ([]model.IdentificationDataType, error)) *IdentificationCommonInterface_GetDataForFilter_Call { +func (_c *IdentificationCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(filter model.IdentificationDataType) ([]model.IdentificationDataType, error)) *IdentificationCommonInterface_GetDataForFilter_Call { _c.Call.Return(run) return _c } - -// NewIdentificationCommonInterface creates a new instance of IdentificationCommonInterface. 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 NewIdentificationCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *IdentificationCommonInterface { - mock := &IdentificationCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/IdentificationServerInterface.go b/mocks/IdentificationServerInterface.go index a7e06bfc..fabac804 100644 --- a/mocks/IdentificationServerInterface.go +++ b/mocks/IdentificationServerInterface.go @@ -1,21 +1,12 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks -import mock "github.com/stretchr/testify/mock" - -// IdentificationServerInterface is an autogenerated mock type for the IdentificationServerInterface type -type IdentificationServerInterface struct { - mock.Mock -} - -type IdentificationServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *IdentificationServerInterface) EXPECT() *IdentificationServerInterface_Expecter { - return &IdentificationServerInterface_Expecter{mock: &_m.Mock} -} +import ( + mock "github.com/stretchr/testify/mock" +) // NewIdentificationServerInterface creates a new instance of IdentificationServerInterface. 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. @@ -30,3 +21,16 @@ func NewIdentificationServerInterface(t interface { return mock } + +// IdentificationServerInterface is an autogenerated mock type for the IdentificationServerInterface type +type IdentificationServerInterface struct { + mock.Mock +} + +type IdentificationServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *IdentificationServerInterface) EXPECT() *IdentificationServerInterface_Expecter { + return &IdentificationServerInterface_Expecter{mock: &_m.Mock} +} diff --git a/mocks/IncentiveTableClientInterface.go b/mocks/IncentiveTableClientInterface.go index 0c5428a9..8229e884 100644 --- a/mocks/IncentiveTableClientInterface.go +++ b/mocks/IncentiveTableClientInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewIncentiveTableClientInterface creates a new instance of IncentiveTableClientInterface. 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 NewIncentiveTableClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *IncentiveTableClientInterface { + mock := &IncentiveTableClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // IncentiveTableClientInterface is an autogenerated mock type for the IncentiveTableClientInterface type type IncentiveTableClientInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *IncentiveTableClientInterface) EXPECT() *IncentiveTableClientInterface return &IncentiveTableClientInterface_Expecter{mock: &_m.Mock} } -// RequestConstraints provides a mock function with no fields -func (_m *IncentiveTableClientInterface) RequestConstraints() (*model.MsgCounterType, error) { - ret := _m.Called() +// RequestConstraints provides a mock function for the type IncentiveTableClientInterface +func (_mock *IncentiveTableClientInterface) RequestConstraints() (*model.MsgCounterType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RequestConstraints") @@ -30,23 +46,21 @@ func (_m *IncentiveTableClientInterface) RequestConstraints() (*model.MsgCounter var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -67,8 +81,8 @@ func (_c *IncentiveTableClientInterface_RequestConstraints_Call) Run(run func()) return _c } -func (_c *IncentiveTableClientInterface_RequestConstraints_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_RequestConstraints_Call { - _c.Call.Return(_a0, _a1) +func (_c *IncentiveTableClientInterface_RequestConstraints_Call) Return(msgCounterType *model.MsgCounterType, err error) *IncentiveTableClientInterface_RequestConstraints_Call { + _c.Call.Return(msgCounterType, err) return _c } @@ -77,9 +91,9 @@ func (_c *IncentiveTableClientInterface_RequestConstraints_Call) RunAndReturn(ru return _c } -// RequestDescriptions provides a mock function with no fields -func (_m *IncentiveTableClientInterface) RequestDescriptions() (*model.MsgCounterType, error) { - ret := _m.Called() +// RequestDescriptions provides a mock function for the type IncentiveTableClientInterface +func (_mock *IncentiveTableClientInterface) RequestDescriptions() (*model.MsgCounterType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RequestDescriptions") @@ -87,23 +101,21 @@ func (_m *IncentiveTableClientInterface) RequestDescriptions() (*model.MsgCounte var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -124,8 +136,8 @@ func (_c *IncentiveTableClientInterface_RequestDescriptions_Call) Run(run func() return _c } -func (_c *IncentiveTableClientInterface_RequestDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_RequestDescriptions_Call { - _c.Call.Return(_a0, _a1) +func (_c *IncentiveTableClientInterface_RequestDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *IncentiveTableClientInterface_RequestDescriptions_Call { + _c.Call.Return(msgCounterType, err) return _c } @@ -134,9 +146,9 @@ func (_c *IncentiveTableClientInterface_RequestDescriptions_Call) RunAndReturn(r return _c } -// RequestValues provides a mock function with no fields -func (_m *IncentiveTableClientInterface) RequestValues() (*model.MsgCounterType, error) { - ret := _m.Called() +// RequestValues provides a mock function for the type IncentiveTableClientInterface +func (_mock *IncentiveTableClientInterface) RequestValues() (*model.MsgCounterType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RequestValues") @@ -144,23 +156,21 @@ func (_m *IncentiveTableClientInterface) RequestValues() (*model.MsgCounterType, var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -181,8 +191,8 @@ func (_c *IncentiveTableClientInterface_RequestValues_Call) Run(run func()) *Inc return _c } -func (_c *IncentiveTableClientInterface_RequestValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_RequestValues_Call { - _c.Call.Return(_a0, _a1) +func (_c *IncentiveTableClientInterface_RequestValues_Call) Return(msgCounterType *model.MsgCounterType, err error) *IncentiveTableClientInterface_RequestValues_Call { + _c.Call.Return(msgCounterType, err) return _c } @@ -191,9 +201,9 @@ func (_c *IncentiveTableClientInterface_RequestValues_Call) RunAndReturn(run fun return _c } -// WriteDescriptions provides a mock function with given fields: data -func (_m *IncentiveTableClientInterface) WriteDescriptions(data []model.IncentiveTableDescriptionType) (*model.MsgCounterType, error) { - ret := _m.Called(data) +// WriteDescriptions provides a mock function for the type IncentiveTableClientInterface +func (_mock *IncentiveTableClientInterface) WriteDescriptions(data []model.IncentiveTableDescriptionType) (*model.MsgCounterType, error) { + ret := _mock.Called(data) if len(ret) == 0 { panic("no return value specified for WriteDescriptions") @@ -201,23 +211,21 @@ func (_m *IncentiveTableClientInterface) WriteDescriptions(data []model.Incentiv var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func([]model.IncentiveTableDescriptionType) (*model.MsgCounterType, error)); ok { - return rf(data) + if returnFunc, ok := ret.Get(0).(func([]model.IncentiveTableDescriptionType) (*model.MsgCounterType, error)); ok { + return returnFunc(data) } - if rf, ok := ret.Get(0).(func([]model.IncentiveTableDescriptionType) *model.MsgCounterType); ok { - r0 = rf(data) + if returnFunc, ok := ret.Get(0).(func([]model.IncentiveTableDescriptionType) *model.MsgCounterType); ok { + r0 = returnFunc(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func([]model.IncentiveTableDescriptionType) error); ok { - r1 = rf(data) + if returnFunc, ok := ret.Get(1).(func([]model.IncentiveTableDescriptionType) error); ok { + r1 = returnFunc(data) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -234,24 +242,30 @@ func (_e *IncentiveTableClientInterface_Expecter) WriteDescriptions(data interfa func (_c *IncentiveTableClientInterface_WriteDescriptions_Call) Run(run func(data []model.IncentiveTableDescriptionType)) *IncentiveTableClientInterface_WriteDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]model.IncentiveTableDescriptionType)) + var arg0 []model.IncentiveTableDescriptionType + if args[0] != nil { + arg0 = args[0].([]model.IncentiveTableDescriptionType) + } + run( + arg0, + ) }) return _c } -func (_c *IncentiveTableClientInterface_WriteDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_WriteDescriptions_Call { - _c.Call.Return(_a0, _a1) +func (_c *IncentiveTableClientInterface_WriteDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *IncentiveTableClientInterface_WriteDescriptions_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *IncentiveTableClientInterface_WriteDescriptions_Call) RunAndReturn(run func([]model.IncentiveTableDescriptionType) (*model.MsgCounterType, error)) *IncentiveTableClientInterface_WriteDescriptions_Call { +func (_c *IncentiveTableClientInterface_WriteDescriptions_Call) RunAndReturn(run func(data []model.IncentiveTableDescriptionType) (*model.MsgCounterType, error)) *IncentiveTableClientInterface_WriteDescriptions_Call { _c.Call.Return(run) return _c } -// WriteValues provides a mock function with given fields: data -func (_m *IncentiveTableClientInterface) WriteValues(data []model.IncentiveTableType) (*model.MsgCounterType, error) { - ret := _m.Called(data) +// WriteValues provides a mock function for the type IncentiveTableClientInterface +func (_mock *IncentiveTableClientInterface) WriteValues(data []model.IncentiveTableType) (*model.MsgCounterType, error) { + ret := _mock.Called(data) if len(ret) == 0 { panic("no return value specified for WriteValues") @@ -259,23 +273,21 @@ func (_m *IncentiveTableClientInterface) WriteValues(data []model.IncentiveTable var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func([]model.IncentiveTableType) (*model.MsgCounterType, error)); ok { - return rf(data) + if returnFunc, ok := ret.Get(0).(func([]model.IncentiveTableType) (*model.MsgCounterType, error)); ok { + return returnFunc(data) } - if rf, ok := ret.Get(0).(func([]model.IncentiveTableType) *model.MsgCounterType); ok { - r0 = rf(data) + if returnFunc, ok := ret.Get(0).(func([]model.IncentiveTableType) *model.MsgCounterType); ok { + r0 = returnFunc(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func([]model.IncentiveTableType) error); ok { - r1 = rf(data) + if returnFunc, ok := ret.Get(1).(func([]model.IncentiveTableType) error); ok { + r1 = returnFunc(data) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -292,31 +304,23 @@ func (_e *IncentiveTableClientInterface_Expecter) WriteValues(data interface{}) func (_c *IncentiveTableClientInterface_WriteValues_Call) Run(run func(data []model.IncentiveTableType)) *IncentiveTableClientInterface_WriteValues_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]model.IncentiveTableType)) + var arg0 []model.IncentiveTableType + if args[0] != nil { + arg0 = args[0].([]model.IncentiveTableType) + } + run( + arg0, + ) }) return _c } -func (_c *IncentiveTableClientInterface_WriteValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_WriteValues_Call { - _c.Call.Return(_a0, _a1) +func (_c *IncentiveTableClientInterface_WriteValues_Call) Return(msgCounterType *model.MsgCounterType, err error) *IncentiveTableClientInterface_WriteValues_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *IncentiveTableClientInterface_WriteValues_Call) RunAndReturn(run func([]model.IncentiveTableType) (*model.MsgCounterType, error)) *IncentiveTableClientInterface_WriteValues_Call { +func (_c *IncentiveTableClientInterface_WriteValues_Call) RunAndReturn(run func(data []model.IncentiveTableType) (*model.MsgCounterType, error)) *IncentiveTableClientInterface_WriteValues_Call { _c.Call.Return(run) return _c } - -// NewIncentiveTableClientInterface creates a new instance of IncentiveTableClientInterface. 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 NewIncentiveTableClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *IncentiveTableClientInterface { - mock := &IncentiveTableClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/IncentiveTableCommonInterface.go b/mocks/IncentiveTableCommonInterface.go index f4536ef3..b465d1b1 100644 --- a/mocks/IncentiveTableCommonInterface.go +++ b/mocks/IncentiveTableCommonInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewIncentiveTableCommonInterface creates a new instance of IncentiveTableCommonInterface. 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 NewIncentiveTableCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *IncentiveTableCommonInterface { + mock := &IncentiveTableCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // IncentiveTableCommonInterface is an autogenerated mock type for the IncentiveTableCommonInterface type type IncentiveTableCommonInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *IncentiveTableCommonInterface) EXPECT() *IncentiveTableCommonInterface return &IncentiveTableCommonInterface_Expecter{mock: &_m.Mock} } -// GetConstraints provides a mock function with no fields -func (_m *IncentiveTableCommonInterface) GetConstraints() ([]model.IncentiveTableConstraintsType, error) { - ret := _m.Called() +// GetConstraints provides a mock function for the type IncentiveTableCommonInterface +func (_mock *IncentiveTableCommonInterface) GetConstraints() ([]model.IncentiveTableConstraintsType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for GetConstraints") @@ -30,23 +46,21 @@ func (_m *IncentiveTableCommonInterface) GetConstraints() ([]model.IncentiveTabl var r0 []model.IncentiveTableConstraintsType var r1 error - if rf, ok := ret.Get(0).(func() ([]model.IncentiveTableConstraintsType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() ([]model.IncentiveTableConstraintsType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() []model.IncentiveTableConstraintsType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() []model.IncentiveTableConstraintsType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.IncentiveTableConstraintsType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -67,8 +81,8 @@ func (_c *IncentiveTableCommonInterface_GetConstraints_Call) Run(run func()) *In return _c } -func (_c *IncentiveTableCommonInterface_GetConstraints_Call) Return(_a0 []model.IncentiveTableConstraintsType, _a1 error) *IncentiveTableCommonInterface_GetConstraints_Call { - _c.Call.Return(_a0, _a1) +func (_c *IncentiveTableCommonInterface_GetConstraints_Call) Return(incentiveTableConstraintsTypes []model.IncentiveTableConstraintsType, err error) *IncentiveTableCommonInterface_GetConstraints_Call { + _c.Call.Return(incentiveTableConstraintsTypes, err) return _c } @@ -77,9 +91,9 @@ func (_c *IncentiveTableCommonInterface_GetConstraints_Call) RunAndReturn(run fu return _c } -// GetData provides a mock function with no fields -func (_m *IncentiveTableCommonInterface) GetData() ([]model.IncentiveTableType, error) { - ret := _m.Called() +// GetData provides a mock function for the type IncentiveTableCommonInterface +func (_mock *IncentiveTableCommonInterface) GetData() ([]model.IncentiveTableType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for GetData") @@ -87,23 +101,21 @@ func (_m *IncentiveTableCommonInterface) GetData() ([]model.IncentiveTableType, var r0 []model.IncentiveTableType var r1 error - if rf, ok := ret.Get(0).(func() ([]model.IncentiveTableType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() ([]model.IncentiveTableType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() []model.IncentiveTableType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() []model.IncentiveTableType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.IncentiveTableType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -124,8 +136,8 @@ func (_c *IncentiveTableCommonInterface_GetData_Call) Run(run func()) *Incentive return _c } -func (_c *IncentiveTableCommonInterface_GetData_Call) Return(_a0 []model.IncentiveTableType, _a1 error) *IncentiveTableCommonInterface_GetData_Call { - _c.Call.Return(_a0, _a1) +func (_c *IncentiveTableCommonInterface_GetData_Call) Return(incentiveTableTypes []model.IncentiveTableType, err error) *IncentiveTableCommonInterface_GetData_Call { + _c.Call.Return(incentiveTableTypes, err) return _c } @@ -134,9 +146,9 @@ func (_c *IncentiveTableCommonInterface_GetData_Call) RunAndReturn(run func() ([ return _c } -// GetDescriptionsForFilter provides a mock function with given fields: filter -func (_m *IncentiveTableCommonInterface) GetDescriptionsForFilter(filter model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error) { - ret := _m.Called(filter) +// GetDescriptionsForFilter provides a mock function for the type IncentiveTableCommonInterface +func (_mock *IncentiveTableCommonInterface) GetDescriptionsForFilter(filter model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionsForFilter") @@ -144,23 +156,21 @@ func (_m *IncentiveTableCommonInterface) GetDescriptionsForFilter(filter model.T var r0 []model.IncentiveTableDescriptionType var r1 error - if rf, ok := ret.Get(0).(func(model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.TariffDescriptionDataType) []model.IncentiveTableDescriptionType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.TariffDescriptionDataType) []model.IncentiveTableDescriptionType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.IncentiveTableDescriptionType) } } - - if rf, ok := ret.Get(1).(func(model.TariffDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.TariffDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -177,31 +187,23 @@ func (_e *IncentiveTableCommonInterface_Expecter) GetDescriptionsForFilter(filte func (_c *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call) Run(run func(filter model.TariffDescriptionDataType)) *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.TariffDescriptionDataType)) + var arg0 model.TariffDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.TariffDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call) Return(_a0 []model.IncentiveTableDescriptionType, _a1 error) *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call) Return(incentiveTableDescriptionTypes []model.IncentiveTableDescriptionType, err error) *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call { + _c.Call.Return(incentiveTableDescriptionTypes, err) return _c } -func (_c *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)) *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call { +func (_c *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(filter model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)) *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Return(run) return _c } - -// NewIncentiveTableCommonInterface creates a new instance of IncentiveTableCommonInterface. 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 NewIncentiveTableCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *IncentiveTableCommonInterface { - mock := &IncentiveTableCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/IncentiveTableServerInterface.go b/mocks/IncentiveTableServerInterface.go index b4b61ec4..8d9eaaab 100644 --- a/mocks/IncentiveTableServerInterface.go +++ b/mocks/IncentiveTableServerInterface.go @@ -1,21 +1,12 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks -import mock "github.com/stretchr/testify/mock" - -// IncentiveTableServerInterface is an autogenerated mock type for the IncentiveTableServerInterface type -type IncentiveTableServerInterface struct { - mock.Mock -} - -type IncentiveTableServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *IncentiveTableServerInterface) EXPECT() *IncentiveTableServerInterface_Expecter { - return &IncentiveTableServerInterface_Expecter{mock: &_m.Mock} -} +import ( + mock "github.com/stretchr/testify/mock" +) // NewIncentiveTableServerInterface creates a new instance of IncentiveTableServerInterface. 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. @@ -30,3 +21,16 @@ func NewIncentiveTableServerInterface(t interface { return mock } + +// IncentiveTableServerInterface is an autogenerated mock type for the IncentiveTableServerInterface type +type IncentiveTableServerInterface struct { + mock.Mock +} + +type IncentiveTableServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *IncentiveTableServerInterface) EXPECT() *IncentiveTableServerInterface_Expecter { + return &IncentiveTableServerInterface_Expecter{mock: &_m.Mock} +} diff --git a/mocks/LoadControlClientInterface.go b/mocks/LoadControlClientInterface.go index cbd5ab7f..79d2bf60 100644 --- a/mocks/LoadControlClientInterface.go +++ b/mocks/LoadControlClientInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewLoadControlClientInterface creates a new instance of LoadControlClientInterface. 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 NewLoadControlClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *LoadControlClientInterface { + mock := &LoadControlClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // LoadControlClientInterface is an autogenerated mock type for the LoadControlClientInterface type type LoadControlClientInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *LoadControlClientInterface) EXPECT() *LoadControlClientInterface_Expec return &LoadControlClientInterface_Expecter{mock: &_m.Mock} } -// RequestLimitConstraints provides a mock function with given fields: selector, elements -func (_m *LoadControlClientInterface) RequestLimitConstraints(selector *model.LoadControlLimitConstraintsListDataSelectorsType, elements *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestLimitConstraints provides a mock function for the type LoadControlClientInterface +func (_mock *LoadControlClientInterface) RequestLimitConstraints(selector *model.LoadControlLimitConstraintsListDataSelectorsType, elements *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestLimitConstraints") @@ -30,23 +46,21 @@ func (_m *LoadControlClientInterface) RequestLimitConstraints(selector *model.Lo var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -64,24 +78,35 @@ func (_e *LoadControlClientInterface_Expecter) RequestLimitConstraints(selector func (_c *LoadControlClientInterface_RequestLimitConstraints_Call) Run(run func(selector *model.LoadControlLimitConstraintsListDataSelectorsType, elements *model.LoadControlLimitConstraintsDataElementsType)) *LoadControlClientInterface_RequestLimitConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.LoadControlLimitConstraintsListDataSelectorsType), args[1].(*model.LoadControlLimitConstraintsDataElementsType)) + var arg0 *model.LoadControlLimitConstraintsListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.LoadControlLimitConstraintsListDataSelectorsType) + } + var arg1 *model.LoadControlLimitConstraintsDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.LoadControlLimitConstraintsDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *LoadControlClientInterface_RequestLimitConstraints_Call) Return(_a0 *model.MsgCounterType, _a1 error) *LoadControlClientInterface_RequestLimitConstraints_Call { - _c.Call.Return(_a0, _a1) +func (_c *LoadControlClientInterface_RequestLimitConstraints_Call) Return(msgCounterType *model.MsgCounterType, err error) *LoadControlClientInterface_RequestLimitConstraints_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *LoadControlClientInterface_RequestLimitConstraints_Call) RunAndReturn(run func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitConstraints_Call { +func (_c *LoadControlClientInterface_RequestLimitConstraints_Call) RunAndReturn(run func(selector *model.LoadControlLimitConstraintsListDataSelectorsType, elements *model.LoadControlLimitConstraintsDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitConstraints_Call { _c.Call.Return(run) return _c } -// RequestLimitData provides a mock function with given fields: selector, elements -func (_m *LoadControlClientInterface) RequestLimitData(selector *model.LoadControlLimitListDataSelectorsType, elements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestLimitData provides a mock function for the type LoadControlClientInterface +func (_mock *LoadControlClientInterface) RequestLimitData(selector *model.LoadControlLimitListDataSelectorsType, elements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestLimitData") @@ -89,23 +114,21 @@ func (_m *LoadControlClientInterface) RequestLimitData(selector *model.LoadContr var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -123,24 +146,35 @@ func (_e *LoadControlClientInterface_Expecter) RequestLimitData(selector interfa func (_c *LoadControlClientInterface_RequestLimitData_Call) Run(run func(selector *model.LoadControlLimitListDataSelectorsType, elements *model.LoadControlLimitDataElementsType)) *LoadControlClientInterface_RequestLimitData_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.LoadControlLimitListDataSelectorsType), args[1].(*model.LoadControlLimitDataElementsType)) + var arg0 *model.LoadControlLimitListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.LoadControlLimitListDataSelectorsType) + } + var arg1 *model.LoadControlLimitDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.LoadControlLimitDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *LoadControlClientInterface_RequestLimitData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *LoadControlClientInterface_RequestLimitData_Call { - _c.Call.Return(_a0, _a1) +func (_c *LoadControlClientInterface_RequestLimitData_Call) Return(msgCounterType *model.MsgCounterType, err error) *LoadControlClientInterface_RequestLimitData_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *LoadControlClientInterface_RequestLimitData_Call) RunAndReturn(run func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitData_Call { +func (_c *LoadControlClientInterface_RequestLimitData_Call) RunAndReturn(run func(selector *model.LoadControlLimitListDataSelectorsType, elements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitData_Call { _c.Call.Return(run) return _c } -// RequestLimitDescriptions provides a mock function with given fields: selector, elements -func (_m *LoadControlClientInterface) RequestLimitDescriptions(selector *model.LoadControlLimitDescriptionListDataSelectorsType, elements *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestLimitDescriptions provides a mock function for the type LoadControlClientInterface +func (_mock *LoadControlClientInterface) RequestLimitDescriptions(selector *model.LoadControlLimitDescriptionListDataSelectorsType, elements *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestLimitDescriptions") @@ -148,23 +182,21 @@ func (_m *LoadControlClientInterface) RequestLimitDescriptions(selector *model.L var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -182,24 +214,35 @@ func (_e *LoadControlClientInterface_Expecter) RequestLimitDescriptions(selector func (_c *LoadControlClientInterface_RequestLimitDescriptions_Call) Run(run func(selector *model.LoadControlLimitDescriptionListDataSelectorsType, elements *model.LoadControlLimitDescriptionDataElementsType)) *LoadControlClientInterface_RequestLimitDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.LoadControlLimitDescriptionListDataSelectorsType), args[1].(*model.LoadControlLimitDescriptionDataElementsType)) + var arg0 *model.LoadControlLimitDescriptionListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.LoadControlLimitDescriptionListDataSelectorsType) + } + var arg1 *model.LoadControlLimitDescriptionDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.LoadControlLimitDescriptionDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *LoadControlClientInterface_RequestLimitDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *LoadControlClientInterface_RequestLimitDescriptions_Call { - _c.Call.Return(_a0, _a1) +func (_c *LoadControlClientInterface_RequestLimitDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *LoadControlClientInterface_RequestLimitDescriptions_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *LoadControlClientInterface_RequestLimitDescriptions_Call) RunAndReturn(run func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitDescriptions_Call { +func (_c *LoadControlClientInterface_RequestLimitDescriptions_Call) RunAndReturn(run func(selector *model.LoadControlLimitDescriptionListDataSelectorsType, elements *model.LoadControlLimitDescriptionDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_RequestLimitDescriptions_Call { _c.Call.Return(run) return _c } -// WriteLimitData provides a mock function with given fields: data, deleteSelectors, deleteElements -func (_m *LoadControlClientInterface) WriteLimitData(data []model.LoadControlLimitDataType, deleteSelectors *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(data, deleteSelectors, deleteElements) +// WriteLimitData provides a mock function for the type LoadControlClientInterface +func (_mock *LoadControlClientInterface) WriteLimitData(data []model.LoadControlLimitDataType, deleteSelectors *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(data, deleteSelectors, deleteElements) if len(ret) == 0 { panic("no return value specified for WriteLimitData") @@ -207,23 +250,21 @@ func (_m *LoadControlClientInterface) WriteLimitData(data []model.LoadControlLim var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(data, deleteSelectors, deleteElements) + if returnFunc, ok := ret.Get(0).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(data, deleteSelectors, deleteElements) } - if rf, ok := ret.Get(0).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) *model.MsgCounterType); ok { - r0 = rf(data, deleteSelectors, deleteElements) + if returnFunc, ok := ret.Get(0).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(data, deleteSelectors, deleteElements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { - r1 = rf(data, deleteSelectors, deleteElements) + if returnFunc, ok := ret.Get(1).(func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { + r1 = returnFunc(data, deleteSelectors, deleteElements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -242,31 +283,33 @@ func (_e *LoadControlClientInterface_Expecter) WriteLimitData(data interface{}, func (_c *LoadControlClientInterface_WriteLimitData_Call) Run(run func(data []model.LoadControlLimitDataType, deleteSelectors *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType)) *LoadControlClientInterface_WriteLimitData_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]model.LoadControlLimitDataType), args[1].(*model.LoadControlLimitListDataSelectorsType), args[2].(*model.LoadControlLimitDataElementsType)) + var arg0 []model.LoadControlLimitDataType + if args[0] != nil { + arg0 = args[0].([]model.LoadControlLimitDataType) + } + var arg1 *model.LoadControlLimitListDataSelectorsType + if args[1] != nil { + arg1 = args[1].(*model.LoadControlLimitListDataSelectorsType) + } + var arg2 *model.LoadControlLimitDataElementsType + if args[2] != nil { + arg2 = args[2].(*model.LoadControlLimitDataElementsType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *LoadControlClientInterface_WriteLimitData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *LoadControlClientInterface_WriteLimitData_Call { - _c.Call.Return(_a0, _a1) +func (_c *LoadControlClientInterface_WriteLimitData_Call) Return(msgCounterType *model.MsgCounterType, err error) *LoadControlClientInterface_WriteLimitData_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *LoadControlClientInterface_WriteLimitData_Call) RunAndReturn(run func([]model.LoadControlLimitDataType, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_WriteLimitData_Call { +func (_c *LoadControlClientInterface_WriteLimitData_Call) RunAndReturn(run func(data []model.LoadControlLimitDataType, deleteSelectors *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) (*model.MsgCounterType, error)) *LoadControlClientInterface_WriteLimitData_Call { _c.Call.Return(run) return _c } - -// NewLoadControlClientInterface creates a new instance of LoadControlClientInterface. 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 NewLoadControlClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *LoadControlClientInterface { - mock := &LoadControlClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/LoadControlCommonInterface.go b/mocks/LoadControlCommonInterface.go index a6f29166..0c4ed62d 100644 --- a/mocks/LoadControlCommonInterface.go +++ b/mocks/LoadControlCommonInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewLoadControlCommonInterface creates a new instance of LoadControlCommonInterface. 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 NewLoadControlCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *LoadControlCommonInterface { + mock := &LoadControlCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // LoadControlCommonInterface is an autogenerated mock type for the LoadControlCommonInterface type type LoadControlCommonInterface struct { mock.Mock @@ -20,21 +36,20 @@ func (_m *LoadControlCommonInterface) EXPECT() *LoadControlCommonInterface_Expec return &LoadControlCommonInterface_Expecter{mock: &_m.Mock} } -// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter -func (_m *LoadControlCommonInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { - ret := _m.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function for the type LoadControlCommonInterface +func (_mock *LoadControlCommonInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { + ret := _mock.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { - r0 = rf(payloadData, filter) + if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { + r0 = returnFunc(payloadData, filter) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -44,32 +59,43 @@ type LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call struct { } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData interface{} -// - filter interface{} +// - payloadData any +// - filter any func (_e *LoadControlCommonInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { return &LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(interface{}), args[1].(interface{})) + var arg0 any + if args[0] != nil { + arg0 = args[0].(any) + } + var arg1 any + if args[1] != nil { + arg1 = args[1].(any) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(_a0) +func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(b) return _c } -func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetLimitDataForFilter provides a mock function with given fields: filter -func (_m *LoadControlCommonInterface) GetLimitDataForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error) { - ret := _m.Called(filter) +// GetLimitDataForFilter provides a mock function for the type LoadControlCommonInterface +func (_mock *LoadControlCommonInterface) GetLimitDataForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetLimitDataForFilter") @@ -77,23 +103,21 @@ func (_m *LoadControlCommonInterface) GetLimitDataForFilter(filter model.LoadCon var r0 []model.LoadControlLimitDataType var r1 error - if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) []model.LoadControlLimitDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) []model.LoadControlLimitDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.LoadControlLimitDataType) } } - - if rf, ok := ret.Get(1).(func(model.LoadControlLimitDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.LoadControlLimitDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -110,24 +134,30 @@ func (_e *LoadControlCommonInterface_Expecter) GetLimitDataForFilter(filter inte func (_c *LoadControlCommonInterface_GetLimitDataForFilter_Call) Run(run func(filter model.LoadControlLimitDescriptionDataType)) *LoadControlCommonInterface_GetLimitDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.LoadControlLimitDescriptionDataType)) + var arg0 model.LoadControlLimitDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.LoadControlLimitDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *LoadControlCommonInterface_GetLimitDataForFilter_Call) Return(_a0 []model.LoadControlLimitDataType, _a1 error) *LoadControlCommonInterface_GetLimitDataForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *LoadControlCommonInterface_GetLimitDataForFilter_Call) Return(loadControlLimitDataTypes []model.LoadControlLimitDataType, err error) *LoadControlCommonInterface_GetLimitDataForFilter_Call { + _c.Call.Return(loadControlLimitDataTypes, err) return _c } -func (_c *LoadControlCommonInterface_GetLimitDataForFilter_Call) RunAndReturn(run func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)) *LoadControlCommonInterface_GetLimitDataForFilter_Call { +func (_c *LoadControlCommonInterface_GetLimitDataForFilter_Call) RunAndReturn(run func(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)) *LoadControlCommonInterface_GetLimitDataForFilter_Call { _c.Call.Return(run) return _c } -// GetLimitDataForId provides a mock function with given fields: limitId -func (_m *LoadControlCommonInterface) GetLimitDataForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error) { - ret := _m.Called(limitId) +// GetLimitDataForId provides a mock function for the type LoadControlCommonInterface +func (_mock *LoadControlCommonInterface) GetLimitDataForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error) { + ret := _mock.Called(limitId) if len(ret) == 0 { panic("no return value specified for GetLimitDataForId") @@ -135,23 +165,21 @@ func (_m *LoadControlCommonInterface) GetLimitDataForId(limitId model.LoadContro var r0 *model.LoadControlLimitDataType var r1 error - if rf, ok := ret.Get(0).(func(model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)); ok { - return rf(limitId) + if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)); ok { + return returnFunc(limitId) } - if rf, ok := ret.Get(0).(func(model.LoadControlLimitIdType) *model.LoadControlLimitDataType); ok { - r0 = rf(limitId) + if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitIdType) *model.LoadControlLimitDataType); ok { + r0 = returnFunc(limitId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.LoadControlLimitDataType) } } - - if rf, ok := ret.Get(1).(func(model.LoadControlLimitIdType) error); ok { - r1 = rf(limitId) + if returnFunc, ok := ret.Get(1).(func(model.LoadControlLimitIdType) error); ok { + r1 = returnFunc(limitId) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -168,24 +196,30 @@ func (_e *LoadControlCommonInterface_Expecter) GetLimitDataForId(limitId interfa func (_c *LoadControlCommonInterface_GetLimitDataForId_Call) Run(run func(limitId model.LoadControlLimitIdType)) *LoadControlCommonInterface_GetLimitDataForId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.LoadControlLimitIdType)) + var arg0 model.LoadControlLimitIdType + if args[0] != nil { + arg0 = args[0].(model.LoadControlLimitIdType) + } + run( + arg0, + ) }) return _c } -func (_c *LoadControlCommonInterface_GetLimitDataForId_Call) Return(_a0 *model.LoadControlLimitDataType, _a1 error) *LoadControlCommonInterface_GetLimitDataForId_Call { - _c.Call.Return(_a0, _a1) +func (_c *LoadControlCommonInterface_GetLimitDataForId_Call) Return(loadControlLimitDataType *model.LoadControlLimitDataType, err error) *LoadControlCommonInterface_GetLimitDataForId_Call { + _c.Call.Return(loadControlLimitDataType, err) return _c } -func (_c *LoadControlCommonInterface_GetLimitDataForId_Call) RunAndReturn(run func(model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)) *LoadControlCommonInterface_GetLimitDataForId_Call { +func (_c *LoadControlCommonInterface_GetLimitDataForId_Call) RunAndReturn(run func(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)) *LoadControlCommonInterface_GetLimitDataForId_Call { _c.Call.Return(run) return _c } -// GetLimitDescriptionForId provides a mock function with given fields: limitId -func (_m *LoadControlCommonInterface) GetLimitDescriptionForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error) { - ret := _m.Called(limitId) +// GetLimitDescriptionForId provides a mock function for the type LoadControlCommonInterface +func (_mock *LoadControlCommonInterface) GetLimitDescriptionForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error) { + ret := _mock.Called(limitId) if len(ret) == 0 { panic("no return value specified for GetLimitDescriptionForId") @@ -193,23 +227,21 @@ func (_m *LoadControlCommonInterface) GetLimitDescriptionForId(limitId model.Loa var r0 *model.LoadControlLimitDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error)); ok { - return rf(limitId) + if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error)); ok { + return returnFunc(limitId) } - if rf, ok := ret.Get(0).(func(model.LoadControlLimitIdType) *model.LoadControlLimitDescriptionDataType); ok { - r0 = rf(limitId) + if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitIdType) *model.LoadControlLimitDescriptionDataType); ok { + r0 = returnFunc(limitId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.LoadControlLimitDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.LoadControlLimitIdType) error); ok { - r1 = rf(limitId) + if returnFunc, ok := ret.Get(1).(func(model.LoadControlLimitIdType) error); ok { + r1 = returnFunc(limitId) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -226,24 +258,30 @@ func (_e *LoadControlCommonInterface_Expecter) GetLimitDescriptionForId(limitId func (_c *LoadControlCommonInterface_GetLimitDescriptionForId_Call) Run(run func(limitId model.LoadControlLimitIdType)) *LoadControlCommonInterface_GetLimitDescriptionForId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.LoadControlLimitIdType)) + var arg0 model.LoadControlLimitIdType + if args[0] != nil { + arg0 = args[0].(model.LoadControlLimitIdType) + } + run( + arg0, + ) }) return _c } -func (_c *LoadControlCommonInterface_GetLimitDescriptionForId_Call) Return(_a0 *model.LoadControlLimitDescriptionDataType, _a1 error) *LoadControlCommonInterface_GetLimitDescriptionForId_Call { - _c.Call.Return(_a0, _a1) +func (_c *LoadControlCommonInterface_GetLimitDescriptionForId_Call) Return(loadControlLimitDescriptionDataType *model.LoadControlLimitDescriptionDataType, err error) *LoadControlCommonInterface_GetLimitDescriptionForId_Call { + _c.Call.Return(loadControlLimitDescriptionDataType, err) return _c } -func (_c *LoadControlCommonInterface_GetLimitDescriptionForId_Call) RunAndReturn(run func(model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error)) *LoadControlCommonInterface_GetLimitDescriptionForId_Call { +func (_c *LoadControlCommonInterface_GetLimitDescriptionForId_Call) RunAndReturn(run func(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error)) *LoadControlCommonInterface_GetLimitDescriptionForId_Call { _c.Call.Return(run) return _c } -// GetLimitDescriptionsForFilter provides a mock function with given fields: filter -func (_m *LoadControlCommonInterface) GetLimitDescriptionsForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error) { - ret := _m.Called(filter) +// GetLimitDescriptionsForFilter provides a mock function for the type LoadControlCommonInterface +func (_mock *LoadControlCommonInterface) GetLimitDescriptionsForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetLimitDescriptionsForFilter") @@ -251,23 +289,21 @@ func (_m *LoadControlCommonInterface) GetLimitDescriptionsForFilter(filter model var r0 []model.LoadControlLimitDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) []model.LoadControlLimitDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) []model.LoadControlLimitDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.LoadControlLimitDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.LoadControlLimitDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.LoadControlLimitDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -284,31 +320,23 @@ func (_e *LoadControlCommonInterface_Expecter) GetLimitDescriptionsForFilter(fil func (_c *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call) Run(run func(filter model.LoadControlLimitDescriptionDataType)) *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.LoadControlLimitDescriptionDataType)) + var arg0 model.LoadControlLimitDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.LoadControlLimitDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call) Return(_a0 []model.LoadControlLimitDescriptionDataType, _a1 error) *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call) Return(loadControlLimitDescriptionDataTypes []model.LoadControlLimitDescriptionDataType, err error) *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call { + _c.Call.Return(loadControlLimitDescriptionDataTypes, err) return _c } -func (_c *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call) RunAndReturn(run func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error)) *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call { +func (_c *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call) RunAndReturn(run func(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error)) *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call { _c.Call.Return(run) return _c } - -// NewLoadControlCommonInterface creates a new instance of LoadControlCommonInterface. 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 NewLoadControlCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *LoadControlCommonInterface { - mock := &LoadControlCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/LoadControlServerInterface.go b/mocks/LoadControlServerInterface.go index 2f404640..902d3e0d 100644 --- a/mocks/LoadControlServerInterface.go +++ b/mocks/LoadControlServerInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - api "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" - - model "github.com/enbility/spine-go/model" ) +// NewLoadControlServerInterface creates a new instance of LoadControlServerInterface. 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 NewLoadControlServerInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *LoadControlServerInterface { + mock := &LoadControlServerInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // LoadControlServerInterface is an autogenerated mock type for the LoadControlServerInterface type type LoadControlServerInterface struct { mock.Mock @@ -22,23 +37,22 @@ func (_m *LoadControlServerInterface) EXPECT() *LoadControlServerInterface_Expec return &LoadControlServerInterface_Expecter{mock: &_m.Mock} } -// AddLimitDescription provides a mock function with given fields: description -func (_m *LoadControlServerInterface) AddLimitDescription(description model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType { - ret := _m.Called(description) +// AddLimitDescription provides a mock function for the type LoadControlServerInterface +func (_mock *LoadControlServerInterface) AddLimitDescription(description model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType { + ret := _mock.Called(description) if len(ret) == 0 { panic("no return value specified for AddLimitDescription") } var r0 *model.LoadControlLimitIdType - if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType); ok { - r0 = rf(description) + if returnFunc, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType); ok { + r0 = returnFunc(description) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.LoadControlLimitIdType) } } - return r0 } @@ -55,36 +69,41 @@ func (_e *LoadControlServerInterface_Expecter) AddLimitDescription(description i func (_c *LoadControlServerInterface_AddLimitDescription_Call) Run(run func(description model.LoadControlLimitDescriptionDataType)) *LoadControlServerInterface_AddLimitDescription_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.LoadControlLimitDescriptionDataType)) + var arg0 model.LoadControlLimitDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.LoadControlLimitDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *LoadControlServerInterface_AddLimitDescription_Call) Return(_a0 *model.LoadControlLimitIdType) *LoadControlServerInterface_AddLimitDescription_Call { - _c.Call.Return(_a0) +func (_c *LoadControlServerInterface_AddLimitDescription_Call) Return(loadControlLimitIdType *model.LoadControlLimitIdType) *LoadControlServerInterface_AddLimitDescription_Call { + _c.Call.Return(loadControlLimitIdType) return _c } -func (_c *LoadControlServerInterface_AddLimitDescription_Call) RunAndReturn(run func(model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType) *LoadControlServerInterface_AddLimitDescription_Call { +func (_c *LoadControlServerInterface_AddLimitDescription_Call) RunAndReturn(run func(description model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType) *LoadControlServerInterface_AddLimitDescription_Call { _c.Call.Return(run) return _c } -// UpdateLimitDataForFilter provides a mock function with given fields: data, deleteSelector, deleteElements -func (_m *LoadControlServerInterface) UpdateLimitDataForFilter(data []api.LoadControlLimitDataForFilter, deleteSelector *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) error { - ret := _m.Called(data, deleteSelector, deleteElements) +// UpdateLimitDataForFilter provides a mock function for the type LoadControlServerInterface +func (_mock *LoadControlServerInterface) UpdateLimitDataForFilter(data []api.LoadControlLimitDataForFilter, deleteSelector *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) error { + ret := _mock.Called(data, deleteSelector, deleteElements) if len(ret) == 0 { panic("no return value specified for UpdateLimitDataForFilter") } var r0 error - if rf, ok := ret.Get(0).(func([]api.LoadControlLimitDataForFilter, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { - r0 = rf(data, deleteSelector, deleteElements) + if returnFunc, ok := ret.Get(0).(func([]api.LoadControlLimitDataForFilter, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok { + r0 = returnFunc(data, deleteSelector, deleteElements) } else { r0 = ret.Error(0) } - return r0 } @@ -103,36 +122,51 @@ func (_e *LoadControlServerInterface_Expecter) UpdateLimitDataForFilter(data int func (_c *LoadControlServerInterface_UpdateLimitDataForFilter_Call) Run(run func(data []api.LoadControlLimitDataForFilter, deleteSelector *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType)) *LoadControlServerInterface_UpdateLimitDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]api.LoadControlLimitDataForFilter), args[1].(*model.LoadControlLimitListDataSelectorsType), args[2].(*model.LoadControlLimitDataElementsType)) + var arg0 []api.LoadControlLimitDataForFilter + if args[0] != nil { + arg0 = args[0].([]api.LoadControlLimitDataForFilter) + } + var arg1 *model.LoadControlLimitListDataSelectorsType + if args[1] != nil { + arg1 = args[1].(*model.LoadControlLimitListDataSelectorsType) + } + var arg2 *model.LoadControlLimitDataElementsType + if args[2] != nil { + arg2 = args[2].(*model.LoadControlLimitDataElementsType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *LoadControlServerInterface_UpdateLimitDataForFilter_Call) Return(_a0 error) *LoadControlServerInterface_UpdateLimitDataForFilter_Call { - _c.Call.Return(_a0) +func (_c *LoadControlServerInterface_UpdateLimitDataForFilter_Call) Return(err error) *LoadControlServerInterface_UpdateLimitDataForFilter_Call { + _c.Call.Return(err) return _c } -func (_c *LoadControlServerInterface_UpdateLimitDataForFilter_Call) RunAndReturn(run func([]api.LoadControlLimitDataForFilter, *model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error) *LoadControlServerInterface_UpdateLimitDataForFilter_Call { +func (_c *LoadControlServerInterface_UpdateLimitDataForFilter_Call) RunAndReturn(run func(data []api.LoadControlLimitDataForFilter, deleteSelector *model.LoadControlLimitListDataSelectorsType, deleteElements *model.LoadControlLimitDataElementsType) error) *LoadControlServerInterface_UpdateLimitDataForFilter_Call { _c.Call.Return(run) return _c } -// UpdateLimitDataForIds provides a mock function with given fields: data -func (_m *LoadControlServerInterface) UpdateLimitDataForIds(data []api.LoadControlLimitDataForID) error { - ret := _m.Called(data) +// UpdateLimitDataForIds provides a mock function for the type LoadControlServerInterface +func (_mock *LoadControlServerInterface) UpdateLimitDataForIds(data []api.LoadControlLimitDataForID) error { + ret := _mock.Called(data) if len(ret) == 0 { panic("no return value specified for UpdateLimitDataForIds") } var r0 error - if rf, ok := ret.Get(0).(func([]api.LoadControlLimitDataForID) error); ok { - r0 = rf(data) + if returnFunc, ok := ret.Get(0).(func([]api.LoadControlLimitDataForID) error); ok { + r0 = returnFunc(data) } else { r0 = ret.Error(0) } - return r0 } @@ -149,31 +183,23 @@ func (_e *LoadControlServerInterface_Expecter) UpdateLimitDataForIds(data interf func (_c *LoadControlServerInterface_UpdateLimitDataForIds_Call) Run(run func(data []api.LoadControlLimitDataForID)) *LoadControlServerInterface_UpdateLimitDataForIds_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]api.LoadControlLimitDataForID)) + var arg0 []api.LoadControlLimitDataForID + if args[0] != nil { + arg0 = args[0].([]api.LoadControlLimitDataForID) + } + run( + arg0, + ) }) return _c } -func (_c *LoadControlServerInterface_UpdateLimitDataForIds_Call) Return(_a0 error) *LoadControlServerInterface_UpdateLimitDataForIds_Call { - _c.Call.Return(_a0) +func (_c *LoadControlServerInterface_UpdateLimitDataForIds_Call) Return(err error) *LoadControlServerInterface_UpdateLimitDataForIds_Call { + _c.Call.Return(err) return _c } -func (_c *LoadControlServerInterface_UpdateLimitDataForIds_Call) RunAndReturn(run func([]api.LoadControlLimitDataForID) error) *LoadControlServerInterface_UpdateLimitDataForIds_Call { +func (_c *LoadControlServerInterface_UpdateLimitDataForIds_Call) RunAndReturn(run func(data []api.LoadControlLimitDataForID) error) *LoadControlServerInterface_UpdateLimitDataForIds_Call { _c.Call.Return(run) return _c } - -// NewLoadControlServerInterface creates a new instance of LoadControlServerInterface. 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 NewLoadControlServerInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *LoadControlServerInterface { - mock := &LoadControlServerInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/MeasurementClientInterface.go b/mocks/MeasurementClientInterface.go index 9b7c08ac..4c3cdd92 100644 --- a/mocks/MeasurementClientInterface.go +++ b/mocks/MeasurementClientInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewMeasurementClientInterface creates a new instance of MeasurementClientInterface. 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 NewMeasurementClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MeasurementClientInterface { + mock := &MeasurementClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // MeasurementClientInterface is an autogenerated mock type for the MeasurementClientInterface type type MeasurementClientInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *MeasurementClientInterface) EXPECT() *MeasurementClientInterface_Expec return &MeasurementClientInterface_Expecter{mock: &_m.Mock} } -// RequestConstraints provides a mock function with given fields: selector, elements -func (_m *MeasurementClientInterface) RequestConstraints(selector *model.MeasurementConstraintsListDataSelectorsType, elements *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestConstraints provides a mock function for the type MeasurementClientInterface +func (_mock *MeasurementClientInterface) RequestConstraints(selector *model.MeasurementConstraintsListDataSelectorsType, elements *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestConstraints") @@ -30,23 +46,21 @@ func (_m *MeasurementClientInterface) RequestConstraints(selector *model.Measure var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -64,24 +78,35 @@ func (_e *MeasurementClientInterface_Expecter) RequestConstraints(selector inter func (_c *MeasurementClientInterface_RequestConstraints_Call) Run(run func(selector *model.MeasurementConstraintsListDataSelectorsType, elements *model.MeasurementConstraintsDataElementsType)) *MeasurementClientInterface_RequestConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.MeasurementConstraintsListDataSelectorsType), args[1].(*model.MeasurementConstraintsDataElementsType)) + var arg0 *model.MeasurementConstraintsListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.MeasurementConstraintsListDataSelectorsType) + } + var arg1 *model.MeasurementConstraintsDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.MeasurementConstraintsDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *MeasurementClientInterface_RequestConstraints_Call) Return(_a0 *model.MsgCounterType, _a1 error) *MeasurementClientInterface_RequestConstraints_Call { - _c.Call.Return(_a0, _a1) +func (_c *MeasurementClientInterface_RequestConstraints_Call) Return(msgCounterType *model.MsgCounterType, err error) *MeasurementClientInterface_RequestConstraints_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *MeasurementClientInterface_RequestConstraints_Call) RunAndReturn(run func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestConstraints_Call { +func (_c *MeasurementClientInterface_RequestConstraints_Call) RunAndReturn(run func(selector *model.MeasurementConstraintsListDataSelectorsType, elements *model.MeasurementConstraintsDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestConstraints_Call { _c.Call.Return(run) return _c } -// RequestData provides a mock function with given fields: selector, elements -func (_m *MeasurementClientInterface) RequestData(selector *model.MeasurementListDataSelectorsType, elements *model.MeasurementDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestData provides a mock function for the type MeasurementClientInterface +func (_mock *MeasurementClientInterface) RequestData(selector *model.MeasurementListDataSelectorsType, elements *model.MeasurementDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestData") @@ -89,23 +114,21 @@ func (_m *MeasurementClientInterface) RequestData(selector *model.MeasurementLis var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -123,24 +146,35 @@ func (_e *MeasurementClientInterface_Expecter) RequestData(selector interface{}, func (_c *MeasurementClientInterface_RequestData_Call) Run(run func(selector *model.MeasurementListDataSelectorsType, elements *model.MeasurementDataElementsType)) *MeasurementClientInterface_RequestData_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.MeasurementListDataSelectorsType), args[1].(*model.MeasurementDataElementsType)) + var arg0 *model.MeasurementListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.MeasurementListDataSelectorsType) + } + var arg1 *model.MeasurementDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.MeasurementDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *MeasurementClientInterface_RequestData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *MeasurementClientInterface_RequestData_Call { - _c.Call.Return(_a0, _a1) +func (_c *MeasurementClientInterface_RequestData_Call) Return(msgCounterType *model.MsgCounterType, err error) *MeasurementClientInterface_RequestData_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *MeasurementClientInterface_RequestData_Call) RunAndReturn(run func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestData_Call { +func (_c *MeasurementClientInterface_RequestData_Call) RunAndReturn(run func(selector *model.MeasurementListDataSelectorsType, elements *model.MeasurementDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestData_Call { _c.Call.Return(run) return _c } -// RequestDescriptions provides a mock function with given fields: selector, elements -func (_m *MeasurementClientInterface) RequestDescriptions(selector *model.MeasurementDescriptionListDataSelectorsType, elements *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestDescriptions provides a mock function for the type MeasurementClientInterface +func (_mock *MeasurementClientInterface) RequestDescriptions(selector *model.MeasurementDescriptionListDataSelectorsType, elements *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestDescriptions") @@ -148,23 +182,21 @@ func (_m *MeasurementClientInterface) RequestDescriptions(selector *model.Measur var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -182,31 +214,28 @@ func (_e *MeasurementClientInterface_Expecter) RequestDescriptions(selector inte func (_c *MeasurementClientInterface_RequestDescriptions_Call) Run(run func(selector *model.MeasurementDescriptionListDataSelectorsType, elements *model.MeasurementDescriptionDataElementsType)) *MeasurementClientInterface_RequestDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.MeasurementDescriptionListDataSelectorsType), args[1].(*model.MeasurementDescriptionDataElementsType)) + var arg0 *model.MeasurementDescriptionListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.MeasurementDescriptionListDataSelectorsType) + } + var arg1 *model.MeasurementDescriptionDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.MeasurementDescriptionDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *MeasurementClientInterface_RequestDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *MeasurementClientInterface_RequestDescriptions_Call { - _c.Call.Return(_a0, _a1) +func (_c *MeasurementClientInterface_RequestDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *MeasurementClientInterface_RequestDescriptions_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *MeasurementClientInterface_RequestDescriptions_Call) RunAndReturn(run func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestDescriptions_Call { +func (_c *MeasurementClientInterface_RequestDescriptions_Call) RunAndReturn(run func(selector *model.MeasurementDescriptionListDataSelectorsType, elements *model.MeasurementDescriptionDataElementsType) (*model.MsgCounterType, error)) *MeasurementClientInterface_RequestDescriptions_Call { _c.Call.Return(run) return _c } - -// NewMeasurementClientInterface creates a new instance of MeasurementClientInterface. 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 NewMeasurementClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MeasurementClientInterface { - mock := &MeasurementClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/MeasurementCommonInterface.go b/mocks/MeasurementCommonInterface.go index 083c9681..76af646f 100644 --- a/mocks/MeasurementCommonInterface.go +++ b/mocks/MeasurementCommonInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewMeasurementCommonInterface creates a new instance of MeasurementCommonInterface. 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 NewMeasurementCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MeasurementCommonInterface { + mock := &MeasurementCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // MeasurementCommonInterface is an autogenerated mock type for the MeasurementCommonInterface type type MeasurementCommonInterface struct { mock.Mock @@ -20,21 +36,20 @@ func (_m *MeasurementCommonInterface) EXPECT() *MeasurementCommonInterface_Expec return &MeasurementCommonInterface_Expecter{mock: &_m.Mock} } -// CheckEventPayloadDataForFilter provides a mock function with given fields: payloadData, filter -func (_m *MeasurementCommonInterface) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) bool { - ret := _m.Called(payloadData, filter) +// CheckEventPayloadDataForFilter provides a mock function for the type MeasurementCommonInterface +func (_mock *MeasurementCommonInterface) CheckEventPayloadDataForFilter(payloadData any, filter any) bool { + ret := _mock.Called(payloadData, filter) if len(ret) == 0 { panic("no return value specified for CheckEventPayloadDataForFilter") } var r0 bool - if rf, ok := ret.Get(0).(func(interface{}, interface{}) bool); ok { - r0 = rf(payloadData, filter) + if returnFunc, ok := ret.Get(0).(func(any, any) bool); ok { + r0 = returnFunc(payloadData, filter) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -44,32 +59,43 @@ type MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call struct { } // CheckEventPayloadDataForFilter is a helper method to define mock.On call -// - payloadData interface{} -// - filter interface{} +// - payloadData any +// - filter any func (_e *MeasurementCommonInterface_Expecter) CheckEventPayloadDataForFilter(payloadData interface{}, filter interface{}) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { return &MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call{Call: _e.mock.On("CheckEventPayloadDataForFilter", payloadData, filter)} } -func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData interface{}, filter interface{})) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) Run(run func(payloadData any, filter any)) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(interface{}), args[1].(interface{})) + var arg0 any + if args[0] != nil { + arg0 = args[0].(any) + } + var arg1 any + if args[1] != nil { + arg1 = args[1].(any) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) Return(_a0 bool) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { - _c.Call.Return(_a0) +func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) Return(b bool) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { + _c.Call.Return(b) return _c } -func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(interface{}, interface{}) bool) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { +func (_c *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call) RunAndReturn(run func(payloadData any, filter any) bool) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call { _c.Call.Return(run) return _c } -// GetConstraintsForFilter provides a mock function with given fields: filter -func (_m *MeasurementCommonInterface) GetConstraintsForFilter(filter model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error) { - ret := _m.Called(filter) +// GetConstraintsForFilter provides a mock function for the type MeasurementCommonInterface +func (_mock *MeasurementCommonInterface) GetConstraintsForFilter(filter model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetConstraintsForFilter") @@ -77,23 +103,21 @@ func (_m *MeasurementCommonInterface) GetConstraintsForFilter(filter model.Measu var r0 []model.MeasurementConstraintsDataType var r1 error - if rf, ok := ret.Get(0).(func(model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.MeasurementConstraintsDataType) []model.MeasurementConstraintsDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.MeasurementConstraintsDataType) []model.MeasurementConstraintsDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.MeasurementConstraintsDataType) } } - - if rf, ok := ret.Get(1).(func(model.MeasurementConstraintsDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.MeasurementConstraintsDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -110,24 +134,30 @@ func (_e *MeasurementCommonInterface_Expecter) GetConstraintsForFilter(filter in func (_c *MeasurementCommonInterface_GetConstraintsForFilter_Call) Run(run func(filter model.MeasurementConstraintsDataType)) *MeasurementCommonInterface_GetConstraintsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.MeasurementConstraintsDataType)) + var arg0 model.MeasurementConstraintsDataType + if args[0] != nil { + arg0 = args[0].(model.MeasurementConstraintsDataType) + } + run( + arg0, + ) }) return _c } -func (_c *MeasurementCommonInterface_GetConstraintsForFilter_Call) Return(_a0 []model.MeasurementConstraintsDataType, _a1 error) *MeasurementCommonInterface_GetConstraintsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *MeasurementCommonInterface_GetConstraintsForFilter_Call) Return(measurementConstraintsDataTypes []model.MeasurementConstraintsDataType, err error) *MeasurementCommonInterface_GetConstraintsForFilter_Call { + _c.Call.Return(measurementConstraintsDataTypes, err) return _c } -func (_c *MeasurementCommonInterface_GetConstraintsForFilter_Call) RunAndReturn(run func(model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error)) *MeasurementCommonInterface_GetConstraintsForFilter_Call { +func (_c *MeasurementCommonInterface_GetConstraintsForFilter_Call) RunAndReturn(run func(filter model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error)) *MeasurementCommonInterface_GetConstraintsForFilter_Call { _c.Call.Return(run) return _c } -// GetDataForFilter provides a mock function with given fields: filter -func (_m *MeasurementCommonInterface) GetDataForFilter(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error) { - ret := _m.Called(filter) +// GetDataForFilter provides a mock function for the type MeasurementCommonInterface +func (_mock *MeasurementCommonInterface) GetDataForFilter(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDataForFilter") @@ -135,23 +165,21 @@ func (_m *MeasurementCommonInterface) GetDataForFilter(filter model.MeasurementD var r0 []model.MeasurementDataType var r1 error - if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) []model.MeasurementDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) []model.MeasurementDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.MeasurementDataType) } } - - if rf, ok := ret.Get(1).(func(model.MeasurementDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.MeasurementDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -168,24 +196,30 @@ func (_e *MeasurementCommonInterface_Expecter) GetDataForFilter(filter interface func (_c *MeasurementCommonInterface_GetDataForFilter_Call) Run(run func(filter model.MeasurementDescriptionDataType)) *MeasurementCommonInterface_GetDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.MeasurementDescriptionDataType)) + var arg0 model.MeasurementDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.MeasurementDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *MeasurementCommonInterface_GetDataForFilter_Call) Return(_a0 []model.MeasurementDataType, _a1 error) *MeasurementCommonInterface_GetDataForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *MeasurementCommonInterface_GetDataForFilter_Call) Return(measurementDataTypes []model.MeasurementDataType, err error) *MeasurementCommonInterface_GetDataForFilter_Call { + _c.Call.Return(measurementDataTypes, err) return _c } -func (_c *MeasurementCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error)) *MeasurementCommonInterface_GetDataForFilter_Call { +func (_c *MeasurementCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error)) *MeasurementCommonInterface_GetDataForFilter_Call { _c.Call.Return(run) return _c } -// GetDataForId provides a mock function with given fields: measurementId -func (_m *MeasurementCommonInterface) GetDataForId(measurementId model.MeasurementIdType) (*model.MeasurementDataType, error) { - ret := _m.Called(measurementId) +// GetDataForId provides a mock function for the type MeasurementCommonInterface +func (_mock *MeasurementCommonInterface) GetDataForId(measurementId model.MeasurementIdType) (*model.MeasurementDataType, error) { + ret := _mock.Called(measurementId) if len(ret) == 0 { panic("no return value specified for GetDataForId") @@ -193,23 +227,21 @@ func (_m *MeasurementCommonInterface) GetDataForId(measurementId model.Measureme var r0 *model.MeasurementDataType var r1 error - if rf, ok := ret.Get(0).(func(model.MeasurementIdType) (*model.MeasurementDataType, error)); ok { - return rf(measurementId) + if returnFunc, ok := ret.Get(0).(func(model.MeasurementIdType) (*model.MeasurementDataType, error)); ok { + return returnFunc(measurementId) } - if rf, ok := ret.Get(0).(func(model.MeasurementIdType) *model.MeasurementDataType); ok { - r0 = rf(measurementId) + if returnFunc, ok := ret.Get(0).(func(model.MeasurementIdType) *model.MeasurementDataType); ok { + r0 = returnFunc(measurementId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MeasurementDataType) } } - - if rf, ok := ret.Get(1).(func(model.MeasurementIdType) error); ok { - r1 = rf(measurementId) + if returnFunc, ok := ret.Get(1).(func(model.MeasurementIdType) error); ok { + r1 = returnFunc(measurementId) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -226,24 +258,30 @@ func (_e *MeasurementCommonInterface_Expecter) GetDataForId(measurementId interf func (_c *MeasurementCommonInterface_GetDataForId_Call) Run(run func(measurementId model.MeasurementIdType)) *MeasurementCommonInterface_GetDataForId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.MeasurementIdType)) + var arg0 model.MeasurementIdType + if args[0] != nil { + arg0 = args[0].(model.MeasurementIdType) + } + run( + arg0, + ) }) return _c } -func (_c *MeasurementCommonInterface_GetDataForId_Call) Return(_a0 *model.MeasurementDataType, _a1 error) *MeasurementCommonInterface_GetDataForId_Call { - _c.Call.Return(_a0, _a1) +func (_c *MeasurementCommonInterface_GetDataForId_Call) Return(measurementDataType *model.MeasurementDataType, err error) *MeasurementCommonInterface_GetDataForId_Call { + _c.Call.Return(measurementDataType, err) return _c } -func (_c *MeasurementCommonInterface_GetDataForId_Call) RunAndReturn(run func(model.MeasurementIdType) (*model.MeasurementDataType, error)) *MeasurementCommonInterface_GetDataForId_Call { +func (_c *MeasurementCommonInterface_GetDataForId_Call) RunAndReturn(run func(measurementId model.MeasurementIdType) (*model.MeasurementDataType, error)) *MeasurementCommonInterface_GetDataForId_Call { _c.Call.Return(run) return _c } -// GetDescriptionForId provides a mock function with given fields: measurementId -func (_m *MeasurementCommonInterface) GetDescriptionForId(measurementId model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error) { - ret := _m.Called(measurementId) +// GetDescriptionForId provides a mock function for the type MeasurementCommonInterface +func (_mock *MeasurementCommonInterface) GetDescriptionForId(measurementId model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error) { + ret := _mock.Called(measurementId) if len(ret) == 0 { panic("no return value specified for GetDescriptionForId") @@ -251,23 +289,21 @@ func (_m *MeasurementCommonInterface) GetDescriptionForId(measurementId model.Me var r0 *model.MeasurementDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error)); ok { - return rf(measurementId) + if returnFunc, ok := ret.Get(0).(func(model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error)); ok { + return returnFunc(measurementId) } - if rf, ok := ret.Get(0).(func(model.MeasurementIdType) *model.MeasurementDescriptionDataType); ok { - r0 = rf(measurementId) + if returnFunc, ok := ret.Get(0).(func(model.MeasurementIdType) *model.MeasurementDescriptionDataType); ok { + r0 = returnFunc(measurementId) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MeasurementDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.MeasurementIdType) error); ok { - r1 = rf(measurementId) + if returnFunc, ok := ret.Get(1).(func(model.MeasurementIdType) error); ok { + r1 = returnFunc(measurementId) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -284,24 +320,30 @@ func (_e *MeasurementCommonInterface_Expecter) GetDescriptionForId(measurementId func (_c *MeasurementCommonInterface_GetDescriptionForId_Call) Run(run func(measurementId model.MeasurementIdType)) *MeasurementCommonInterface_GetDescriptionForId_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.MeasurementIdType)) + var arg0 model.MeasurementIdType + if args[0] != nil { + arg0 = args[0].(model.MeasurementIdType) + } + run( + arg0, + ) }) return _c } -func (_c *MeasurementCommonInterface_GetDescriptionForId_Call) Return(_a0 *model.MeasurementDescriptionDataType, _a1 error) *MeasurementCommonInterface_GetDescriptionForId_Call { - _c.Call.Return(_a0, _a1) +func (_c *MeasurementCommonInterface_GetDescriptionForId_Call) Return(measurementDescriptionDataType *model.MeasurementDescriptionDataType, err error) *MeasurementCommonInterface_GetDescriptionForId_Call { + _c.Call.Return(measurementDescriptionDataType, err) return _c } -func (_c *MeasurementCommonInterface_GetDescriptionForId_Call) RunAndReturn(run func(model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error)) *MeasurementCommonInterface_GetDescriptionForId_Call { +func (_c *MeasurementCommonInterface_GetDescriptionForId_Call) RunAndReturn(run func(measurementId model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error)) *MeasurementCommonInterface_GetDescriptionForId_Call { _c.Call.Return(run) return _c } -// GetDescriptionsForFilter provides a mock function with given fields: filter -func (_m *MeasurementCommonInterface) GetDescriptionsForFilter(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error) { - ret := _m.Called(filter) +// GetDescriptionsForFilter provides a mock function for the type MeasurementCommonInterface +func (_mock *MeasurementCommonInterface) GetDescriptionsForFilter(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionsForFilter") @@ -309,23 +351,21 @@ func (_m *MeasurementCommonInterface) GetDescriptionsForFilter(filter model.Meas var r0 []model.MeasurementDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) []model.MeasurementDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) []model.MeasurementDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.MeasurementDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.MeasurementDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.MeasurementDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -342,31 +382,23 @@ func (_e *MeasurementCommonInterface_Expecter) GetDescriptionsForFilter(filter i func (_c *MeasurementCommonInterface_GetDescriptionsForFilter_Call) Run(run func(filter model.MeasurementDescriptionDataType)) *MeasurementCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.MeasurementDescriptionDataType)) + var arg0 model.MeasurementDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.MeasurementDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *MeasurementCommonInterface_GetDescriptionsForFilter_Call) Return(_a0 []model.MeasurementDescriptionDataType, _a1 error) *MeasurementCommonInterface_GetDescriptionsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *MeasurementCommonInterface_GetDescriptionsForFilter_Call) Return(measurementDescriptionDataTypes []model.MeasurementDescriptionDataType, err error) *MeasurementCommonInterface_GetDescriptionsForFilter_Call { + _c.Call.Return(measurementDescriptionDataTypes, err) return _c } -func (_c *MeasurementCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error)) *MeasurementCommonInterface_GetDescriptionsForFilter_Call { +func (_c *MeasurementCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(filter model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error)) *MeasurementCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Return(run) return _c } - -// NewMeasurementCommonInterface creates a new instance of MeasurementCommonInterface. 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 NewMeasurementCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MeasurementCommonInterface { - mock := &MeasurementCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/MeasurementServerInterface.go b/mocks/MeasurementServerInterface.go index 1518bc1b..81683c75 100644 --- a/mocks/MeasurementServerInterface.go +++ b/mocks/MeasurementServerInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - api "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" - - model "github.com/enbility/spine-go/model" ) +// NewMeasurementServerInterface creates a new instance of MeasurementServerInterface. 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 NewMeasurementServerInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MeasurementServerInterface { + mock := &MeasurementServerInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // MeasurementServerInterface is an autogenerated mock type for the MeasurementServerInterface type type MeasurementServerInterface struct { mock.Mock @@ -22,23 +37,22 @@ func (_m *MeasurementServerInterface) EXPECT() *MeasurementServerInterface_Expec return &MeasurementServerInterface_Expecter{mock: &_m.Mock} } -// AddDescription provides a mock function with given fields: description -func (_m *MeasurementServerInterface) AddDescription(description model.MeasurementDescriptionDataType) *model.MeasurementIdType { - ret := _m.Called(description) +// AddDescription provides a mock function for the type MeasurementServerInterface +func (_mock *MeasurementServerInterface) AddDescription(description model.MeasurementDescriptionDataType) *model.MeasurementIdType { + ret := _mock.Called(description) if len(ret) == 0 { panic("no return value specified for AddDescription") } var r0 *model.MeasurementIdType - if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) *model.MeasurementIdType); ok { - r0 = rf(description) + if returnFunc, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) *model.MeasurementIdType); ok { + r0 = returnFunc(description) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MeasurementIdType) } } - return r0 } @@ -55,36 +69,41 @@ func (_e *MeasurementServerInterface_Expecter) AddDescription(description interf func (_c *MeasurementServerInterface_AddDescription_Call) Run(run func(description model.MeasurementDescriptionDataType)) *MeasurementServerInterface_AddDescription_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.MeasurementDescriptionDataType)) + var arg0 model.MeasurementDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.MeasurementDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *MeasurementServerInterface_AddDescription_Call) Return(_a0 *model.MeasurementIdType) *MeasurementServerInterface_AddDescription_Call { - _c.Call.Return(_a0) +func (_c *MeasurementServerInterface_AddDescription_Call) Return(measurementIdType *model.MeasurementIdType) *MeasurementServerInterface_AddDescription_Call { + _c.Call.Return(measurementIdType) return _c } -func (_c *MeasurementServerInterface_AddDescription_Call) RunAndReturn(run func(model.MeasurementDescriptionDataType) *model.MeasurementIdType) *MeasurementServerInterface_AddDescription_Call { +func (_c *MeasurementServerInterface_AddDescription_Call) RunAndReturn(run func(description model.MeasurementDescriptionDataType) *model.MeasurementIdType) *MeasurementServerInterface_AddDescription_Call { _c.Call.Return(run) return _c } -// UpdateDataForFilters provides a mock function with given fields: data, deleteSelector, deleteElements -func (_m *MeasurementServerInterface) UpdateDataForFilters(data []api.MeasurementDataForFilter, deleteSelector *model.MeasurementListDataSelectorsType, deleteElements *model.MeasurementDataElementsType) error { - ret := _m.Called(data, deleteSelector, deleteElements) +// UpdateDataForFilters provides a mock function for the type MeasurementServerInterface +func (_mock *MeasurementServerInterface) UpdateDataForFilters(data []api.MeasurementDataForFilter, deleteSelector *model.MeasurementListDataSelectorsType, deleteElements *model.MeasurementDataElementsType) error { + ret := _mock.Called(data, deleteSelector, deleteElements) if len(ret) == 0 { panic("no return value specified for UpdateDataForFilters") } var r0 error - if rf, ok := ret.Get(0).(func([]api.MeasurementDataForFilter, *model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) error); ok { - r0 = rf(data, deleteSelector, deleteElements) + if returnFunc, ok := ret.Get(0).(func([]api.MeasurementDataForFilter, *model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) error); ok { + r0 = returnFunc(data, deleteSelector, deleteElements) } else { r0 = ret.Error(0) } - return r0 } @@ -103,36 +122,51 @@ func (_e *MeasurementServerInterface_Expecter) UpdateDataForFilters(data interfa func (_c *MeasurementServerInterface_UpdateDataForFilters_Call) Run(run func(data []api.MeasurementDataForFilter, deleteSelector *model.MeasurementListDataSelectorsType, deleteElements *model.MeasurementDataElementsType)) *MeasurementServerInterface_UpdateDataForFilters_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]api.MeasurementDataForFilter), args[1].(*model.MeasurementListDataSelectorsType), args[2].(*model.MeasurementDataElementsType)) + var arg0 []api.MeasurementDataForFilter + if args[0] != nil { + arg0 = args[0].([]api.MeasurementDataForFilter) + } + var arg1 *model.MeasurementListDataSelectorsType + if args[1] != nil { + arg1 = args[1].(*model.MeasurementListDataSelectorsType) + } + var arg2 *model.MeasurementDataElementsType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementDataElementsType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MeasurementServerInterface_UpdateDataForFilters_Call) Return(_a0 error) *MeasurementServerInterface_UpdateDataForFilters_Call { - _c.Call.Return(_a0) +func (_c *MeasurementServerInterface_UpdateDataForFilters_Call) Return(err error) *MeasurementServerInterface_UpdateDataForFilters_Call { + _c.Call.Return(err) return _c } -func (_c *MeasurementServerInterface_UpdateDataForFilters_Call) RunAndReturn(run func([]api.MeasurementDataForFilter, *model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) error) *MeasurementServerInterface_UpdateDataForFilters_Call { +func (_c *MeasurementServerInterface_UpdateDataForFilters_Call) RunAndReturn(run func(data []api.MeasurementDataForFilter, deleteSelector *model.MeasurementListDataSelectorsType, deleteElements *model.MeasurementDataElementsType) error) *MeasurementServerInterface_UpdateDataForFilters_Call { _c.Call.Return(run) return _c } -// UpdateDataForIds provides a mock function with given fields: data -func (_m *MeasurementServerInterface) UpdateDataForIds(data []api.MeasurementDataForID) error { - ret := _m.Called(data) +// UpdateDataForIds provides a mock function for the type MeasurementServerInterface +func (_mock *MeasurementServerInterface) UpdateDataForIds(data []api.MeasurementDataForID) error { + ret := _mock.Called(data) if len(ret) == 0 { panic("no return value specified for UpdateDataForIds") } var r0 error - if rf, ok := ret.Get(0).(func([]api.MeasurementDataForID) error); ok { - r0 = rf(data) + if returnFunc, ok := ret.Get(0).(func([]api.MeasurementDataForID) error); ok { + r0 = returnFunc(data) } else { r0 = ret.Error(0) } - return r0 } @@ -149,31 +183,23 @@ func (_e *MeasurementServerInterface_Expecter) UpdateDataForIds(data interface{} func (_c *MeasurementServerInterface_UpdateDataForIds_Call) Run(run func(data []api.MeasurementDataForID)) *MeasurementServerInterface_UpdateDataForIds_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]api.MeasurementDataForID)) + var arg0 []api.MeasurementDataForID + if args[0] != nil { + arg0 = args[0].([]api.MeasurementDataForID) + } + run( + arg0, + ) }) return _c } -func (_c *MeasurementServerInterface_UpdateDataForIds_Call) Return(_a0 error) *MeasurementServerInterface_UpdateDataForIds_Call { - _c.Call.Return(_a0) +func (_c *MeasurementServerInterface_UpdateDataForIds_Call) Return(err error) *MeasurementServerInterface_UpdateDataForIds_Call { + _c.Call.Return(err) return _c } -func (_c *MeasurementServerInterface_UpdateDataForIds_Call) RunAndReturn(run func([]api.MeasurementDataForID) error) *MeasurementServerInterface_UpdateDataForIds_Call { +func (_c *MeasurementServerInterface_UpdateDataForIds_Call) RunAndReturn(run func(data []api.MeasurementDataForID) error) *MeasurementServerInterface_UpdateDataForIds_Call { _c.Call.Return(run) return _c } - -// NewMeasurementServerInterface creates a new instance of MeasurementServerInterface. 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 NewMeasurementServerInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MeasurementServerInterface { - mock := &MeasurementServerInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/ServiceInterface.go b/mocks/ServiceInterface.go index 05c6003d..3b0f3a7e 100644 --- a/mocks/ServiceInterface.go +++ b/mocks/ServiceInterface.go @@ -1,4 +1,6 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks @@ -8,11 +10,21 @@ import ( "github.com/enbility/ship-go/logging" api1 "github.com/enbility/spine-go/api" mock "github.com/stretchr/testify/mock" +) - ship_goapi "github.com/enbility/ship-go/api" +// NewServiceInterface creates a new instance of ServiceInterface. 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 NewServiceInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *ServiceInterface { + mock := &ServiceInterface{} + mock.Mock.Test(t) - spine_goapi "github.com/enbility/spine-go/api" -) + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} // ServiceInterface is an autogenerated mock type for the ServiceInterface type type ServiceInterface struct { @@ -27,21 +39,20 @@ func (_m *ServiceInterface) EXPECT() *ServiceInterface_Expecter { return &ServiceInterface_Expecter{mock: &_m.Mock} } -// AddUseCase provides a mock function with given fields: useCase -func (_m *ServiceInterface) AddUseCase(useCase api.UseCaseInterface) error { - ret := _m.Called(useCase) +// AddUseCase provides a mock function for the type ServiceInterface +func (_mock *ServiceInterface) AddUseCase(useCase api.UseCaseInterface) error { + ret := _mock.Called(useCase) if len(ret) == 0 { panic("no return value specified for AddUseCase") } var r0 error - if rf, ok := ret.Get(0).(func(api.UseCaseInterface) error); ok { - r0 = rf(useCase) + if returnFunc, ok := ret.Get(0).(func(api.UseCaseInterface) error); ok { + r0 = returnFunc(useCase) } else { r0 = ret.Error(0) } - return r0 } @@ -58,17 +69,23 @@ func (_e *ServiceInterface_Expecter) AddUseCase(useCase interface{}) *ServiceInt func (_c *ServiceInterface_AddUseCase_Call) Run(run func(useCase api.UseCaseInterface)) *ServiceInterface_AddUseCase_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(api.UseCaseInterface)) + var arg0 api.UseCaseInterface + if args[0] != nil { + arg0 = args[0].(api.UseCaseInterface) + } + run( + arg0, + ) }) return _c } -func (_c *ServiceInterface_AddUseCase_Call) Return(_a0 error) *ServiceInterface_AddUseCase_Call { - _c.Call.Return(_a0) +func (_c *ServiceInterface_AddUseCase_Call) Return(err error) *ServiceInterface_AddUseCase_Call { + _c.Call.Return(err) return _c } -func (_c *ServiceInterface_AddUseCase_Call) RunAndReturn(run func(api.UseCaseInterface) error) *ServiceInterface_AddUseCase_Call { +func (_c *ServiceInterface_AddUseCase_Call) RunAndReturn(run func(useCase api.UseCaseInterface) error) *ServiceInterface_AddUseCase_Call { _c.Call.Return(run) return _c } @@ -113,23 +130,22 @@ func (_c *ServiceInterface_CancelPairing_Call) RunAndReturn(run func(identity ap return _c } -// Configuration provides a mock function with no fields -func (_m *ServiceInterface) Configuration() *api.Configuration { - ret := _m.Called() +// Configuration provides a mock function for the type ServiceInterface +func (_mock *ServiceInterface) Configuration() *api.Configuration { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Configuration") } var r0 *api.Configuration - if rf, ok := ret.Get(0).(func() *api.Configuration); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *api.Configuration); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*api.Configuration) } } - return r0 } @@ -150,8 +166,8 @@ func (_c *ServiceInterface_Configuration_Call) Run(run func()) *ServiceInterface return _c } -func (_c *ServiceInterface_Configuration_Call) Return(_a0 *api.Configuration) *ServiceInterface_Configuration_Call { - _c.Call.Return(_a0) +func (_c *ServiceInterface_Configuration_Call) Return(configuration *api.Configuration) *ServiceInterface_Configuration_Call { + _c.Call.Return(configuration) return _c } @@ -411,12 +427,11 @@ func (_mock *ServiceInterface) IsAutoAcceptEnabled() bool { } var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -437,8 +452,8 @@ func (_c *ServiceInterface_IsAutoAcceptEnabled_Call) Run(run func()) *ServiceInt return _c } -func (_c *ServiceInterface_IsAutoAcceptEnabled_Call) Return(_a0 bool) *ServiceInterface_IsAutoAcceptEnabled_Call { - _c.Call.Return(_a0) +func (_c *ServiceInterface_IsAutoAcceptEnabled_Call) Return(b bool) *ServiceInterface_IsAutoAcceptEnabled_Call { + _c.Call.Return(b) return _c } @@ -447,21 +462,20 @@ func (_c *ServiceInterface_IsAutoAcceptEnabled_Call) RunAndReturn(run func() boo return _c } -// IsRunning provides a mock function with no fields -func (_m *ServiceInterface) IsRunning() bool { - ret := _m.Called() +// IsRunning provides a mock function for the type ServiceInterface +func (_mock *ServiceInterface) IsRunning() bool { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for IsRunning") } var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -482,8 +496,8 @@ func (_c *ServiceInterface_IsRunning_Call) Run(run func()) *ServiceInterface_IsR return _c } -func (_c *ServiceInterface_IsRunning_Call) Return(_a0 bool) *ServiceInterface_IsRunning_Call { - _c.Call.Return(_a0) +func (_c *ServiceInterface_IsRunning_Call) Return(b bool) *ServiceInterface_IsRunning_Call { + _c.Call.Return(b) return _c } @@ -508,7 +522,6 @@ func (_mock *ServiceInterface) LocalDevice() api1.DeviceLocalInterface { r0 = ret.Get(0).(api1.DeviceLocalInterface) } } - return r0 } @@ -555,7 +568,6 @@ func (_mock *ServiceInterface) LocalService() *api0.ServiceDetails { r0 = ret.Get(0).(*api0.ServiceDetails) } } - return r0 } @@ -602,7 +614,6 @@ func (_mock *ServiceInterface) PairingDetailFor(identity api0.ServiceIdentity) * r0 = ret.Get(0).(*api0.ConnectionStateDetail) } } - return r0 } @@ -749,7 +760,6 @@ func (_mock *ServiceInterface) RemoteServiceFor(identity api0.ServiceIdentity) * r0 = ret.Get(0).(*api0.ServiceDetails) } } - return r0 } @@ -787,9 +797,10 @@ func (_c *ServiceInterface_RemoteServiceFor_Call) RunAndReturn(run func(identity return _c } -// SetAutoAccept provides a mock function with given fields: value -func (_m *ServiceInterface) SetAutoAccept(value bool) { - _m.Called(value) +// SetAutoAccept provides a mock function for the type ServiceInterface +func (_mock *ServiceInterface) SetAutoAccept(value bool) { + _mock.Called(value) + return } // ServiceInterface_SetAutoAccept_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetAutoAccept' @@ -805,7 +816,13 @@ func (_e *ServiceInterface_Expecter) SetAutoAccept(value interface{}) *ServiceIn func (_c *ServiceInterface_SetAutoAccept_Call) Run(run func(value bool)) *ServiceInterface_SetAutoAccept_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -815,14 +832,15 @@ func (_c *ServiceInterface_SetAutoAccept_Call) Return() *ServiceInterface_SetAut return _c } -func (_c *ServiceInterface_SetAutoAccept_Call) RunAndReturn(run func(bool)) *ServiceInterface_SetAutoAccept_Call { +func (_c *ServiceInterface_SetAutoAccept_Call) RunAndReturn(run func(value bool)) *ServiceInterface_SetAutoAccept_Call { _c.Run(run) return _c } -// SetLogging provides a mock function with given fields: logger -func (_m *ServiceInterface) SetLogging(logger logging.LoggingInterface) { - _m.Called(logger) +// SetLogging provides a mock function for the type ServiceInterface +func (_mock *ServiceInterface) SetLogging(logger logging.LoggingInterface) { + _mock.Called(logger) + return } // ServiceInterface_SetLogging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetLogging' @@ -838,7 +856,13 @@ func (_e *ServiceInterface_Expecter) SetLogging(logger interface{}) *ServiceInte func (_c *ServiceInterface_SetLogging_Call) Run(run func(logger logging.LoggingInterface)) *ServiceInterface_SetLogging_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(logging.LoggingInterface)) + var arg0 logging.LoggingInterface + if args[0] != nil { + arg0 = args[0].(logging.LoggingInterface) + } + run( + arg0, + ) }) return _c } @@ -848,26 +872,25 @@ func (_c *ServiceInterface_SetLogging_Call) Return() *ServiceInterface_SetLoggin return _c } -func (_c *ServiceInterface_SetLogging_Call) RunAndReturn(run func(logging.LoggingInterface)) *ServiceInterface_SetLogging_Call { +func (_c *ServiceInterface_SetLogging_Call) RunAndReturn(run func(logger logging.LoggingInterface)) *ServiceInterface_SetLogging_Call { _c.Run(run) return _c } -// Setup provides a mock function with no fields -func (_m *ServiceInterface) Setup() error { - ret := _m.Called() +// Setup provides a mock function for the type ServiceInterface +func (_mock *ServiceInterface) Setup() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Setup") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -888,8 +911,8 @@ func (_c *ServiceInterface_Setup_Call) Run(run func()) *ServiceInterface_Setup_C return _c } -func (_c *ServiceInterface_Setup_Call) Return(_a0 error) *ServiceInterface_Setup_Call { - _c.Call.Return(_a0) +func (_c *ServiceInterface_Setup_Call) Return(err error) *ServiceInterface_Setup_Call { + _c.Call.Return(err) return _c } @@ -898,9 +921,10 @@ func (_c *ServiceInterface_Setup_Call) RunAndReturn(run func() error) *ServiceIn return _c } -// Shutdown provides a mock function with no fields -func (_m *ServiceInterface) Shutdown() { - _m.Called() +// Shutdown provides a mock function for the type ServiceInterface +func (_mock *ServiceInterface) Shutdown() { + _mock.Called() + return } // ServiceInterface_Shutdown_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Shutdown' @@ -1116,9 +1140,10 @@ func (_c *ServiceInterface_UnregisterRemoteService_Call) RunAndReturn(run func(i return _c } -// UserIsAbleToApproveOrCancelPairingRequests provides a mock function with given fields: allow -func (_m *ServiceInterface) UserIsAbleToApproveOrCancelPairingRequests(allow bool) { - _m.Called(allow) +// UserIsAbleToApproveOrCancelPairingRequests provides a mock function for the type ServiceInterface +func (_mock *ServiceInterface) UserIsAbleToApproveOrCancelPairingRequests(allow bool) { + _mock.Called(allow) + return } // ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UserIsAbleToApproveOrCancelPairingRequests' @@ -1134,7 +1159,13 @@ func (_e *ServiceInterface_Expecter) UserIsAbleToApproveOrCancelPairingRequests( func (_c *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call) Run(run func(allow bool)) *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -1144,21 +1175,7 @@ func (_c *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call) Retu return _c } -func (_c *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call) RunAndReturn(run func(bool)) *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call { +func (_c *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call) RunAndReturn(run func(allow bool)) *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call { _c.Run(run) return _c } - -// NewServiceInterface creates a new instance of ServiceInterface. 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 NewServiceInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *ServiceInterface { - mock := &ServiceInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/ServiceReaderInterface.go b/mocks/ServiceReaderInterface.go index 42dc1ec8..c39a64a2 100644 --- a/mocks/ServiceReaderInterface.go +++ b/mocks/ServiceReaderInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - api "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/ship-go/api" mock "github.com/stretchr/testify/mock" - - ship_goapi "github.com/enbility/ship-go/api" ) +// NewServiceReaderInterface creates a new instance of ServiceReaderInterface. 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 NewServiceReaderInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *ServiceReaderInterface { + mock := &ServiceReaderInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // ServiceReaderInterface is an autogenerated mock type for the ServiceReaderInterface type type ServiceReaderInterface struct { mock.Mock @@ -395,17 +410,3 @@ func (_c *ServiceReaderInterface_VisibleRemoteMdnsServicesUpdated_Call) RunAndRe _c.Run(run) return _c } - -// NewServiceReaderInterface creates a new instance of ServiceReaderInterface. 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 NewServiceReaderInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *ServiceReaderInterface { - mock := &ServiceReaderInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/SmartEnergyManagementPsClientInterface.go b/mocks/SmartEnergyManagementPsClientInterface.go index fa95fe36..743c9117 100644 --- a/mocks/SmartEnergyManagementPsClientInterface.go +++ b/mocks/SmartEnergyManagementPsClientInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewSmartEnergyManagementPsClientInterface creates a new instance of SmartEnergyManagementPsClientInterface. 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 NewSmartEnergyManagementPsClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *SmartEnergyManagementPsClientInterface { + mock := &SmartEnergyManagementPsClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // SmartEnergyManagementPsClientInterface is an autogenerated mock type for the SmartEnergyManagementPsClientInterface type type SmartEnergyManagementPsClientInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *SmartEnergyManagementPsClientInterface) EXPECT() *SmartEnergyManagemen return &SmartEnergyManagementPsClientInterface_Expecter{mock: &_m.Mock} } -// RequestData provides a mock function with no fields -func (_m *SmartEnergyManagementPsClientInterface) RequestData() (*model.MsgCounterType, error) { - ret := _m.Called() +// RequestData provides a mock function for the type SmartEnergyManagementPsClientInterface +func (_mock *SmartEnergyManagementPsClientInterface) RequestData() (*model.MsgCounterType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RequestData") @@ -30,23 +46,21 @@ func (_m *SmartEnergyManagementPsClientInterface) RequestData() (*model.MsgCount var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.MsgCounterType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.MsgCounterType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -67,8 +81,8 @@ func (_c *SmartEnergyManagementPsClientInterface_RequestData_Call) Run(run func( return _c } -func (_c *SmartEnergyManagementPsClientInterface_RequestData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *SmartEnergyManagementPsClientInterface_RequestData_Call { - _c.Call.Return(_a0, _a1) +func (_c *SmartEnergyManagementPsClientInterface_RequestData_Call) Return(msgCounterType *model.MsgCounterType, err error) *SmartEnergyManagementPsClientInterface_RequestData_Call { + _c.Call.Return(msgCounterType, err) return _c } @@ -77,9 +91,9 @@ func (_c *SmartEnergyManagementPsClientInterface_RequestData_Call) RunAndReturn( return _c } -// WriteData provides a mock function with given fields: data -func (_m *SmartEnergyManagementPsClientInterface) WriteData(data *model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error) { - ret := _m.Called(data) +// WriteData provides a mock function for the type SmartEnergyManagementPsClientInterface +func (_mock *SmartEnergyManagementPsClientInterface) WriteData(data *model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error) { + ret := _mock.Called(data) if len(ret) == 0 { panic("no return value specified for WriteData") @@ -87,23 +101,21 @@ func (_m *SmartEnergyManagementPsClientInterface) WriteData(data *model.SmartEne var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error)); ok { - return rf(data) + if returnFunc, ok := ret.Get(0).(func(*model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error)); ok { + return returnFunc(data) } - if rf, ok := ret.Get(0).(func(*model.SmartEnergyManagementPsDataType) *model.MsgCounterType); ok { - r0 = rf(data) + if returnFunc, ok := ret.Get(0).(func(*model.SmartEnergyManagementPsDataType) *model.MsgCounterType); ok { + r0 = returnFunc(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.SmartEnergyManagementPsDataType) error); ok { - r1 = rf(data) + if returnFunc, ok := ret.Get(1).(func(*model.SmartEnergyManagementPsDataType) error); ok { + r1 = returnFunc(data) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -120,31 +132,23 @@ func (_e *SmartEnergyManagementPsClientInterface_Expecter) WriteData(data interf func (_c *SmartEnergyManagementPsClientInterface_WriteData_Call) Run(run func(data *model.SmartEnergyManagementPsDataType)) *SmartEnergyManagementPsClientInterface_WriteData_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.SmartEnergyManagementPsDataType)) + var arg0 *model.SmartEnergyManagementPsDataType + if args[0] != nil { + arg0 = args[0].(*model.SmartEnergyManagementPsDataType) + } + run( + arg0, + ) }) return _c } -func (_c *SmartEnergyManagementPsClientInterface_WriteData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *SmartEnergyManagementPsClientInterface_WriteData_Call { - _c.Call.Return(_a0, _a1) +func (_c *SmartEnergyManagementPsClientInterface_WriteData_Call) Return(msgCounterType *model.MsgCounterType, err error) *SmartEnergyManagementPsClientInterface_WriteData_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *SmartEnergyManagementPsClientInterface_WriteData_Call) RunAndReturn(run func(*model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error)) *SmartEnergyManagementPsClientInterface_WriteData_Call { +func (_c *SmartEnergyManagementPsClientInterface_WriteData_Call) RunAndReturn(run func(data *model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error)) *SmartEnergyManagementPsClientInterface_WriteData_Call { _c.Call.Return(run) return _c } - -// NewSmartEnergyManagementPsClientInterface creates a new instance of SmartEnergyManagementPsClientInterface. 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 NewSmartEnergyManagementPsClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *SmartEnergyManagementPsClientInterface { - mock := &SmartEnergyManagementPsClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/SmartEnergyManagementPsCommonInterface.go b/mocks/SmartEnergyManagementPsCommonInterface.go index 6ffe4e1b..9ad01737 100644 --- a/mocks/SmartEnergyManagementPsCommonInterface.go +++ b/mocks/SmartEnergyManagementPsCommonInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewSmartEnergyManagementPsCommonInterface creates a new instance of SmartEnergyManagementPsCommonInterface. 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 NewSmartEnergyManagementPsCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *SmartEnergyManagementPsCommonInterface { + mock := &SmartEnergyManagementPsCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // SmartEnergyManagementPsCommonInterface is an autogenerated mock type for the SmartEnergyManagementPsCommonInterface type type SmartEnergyManagementPsCommonInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *SmartEnergyManagementPsCommonInterface) EXPECT() *SmartEnergyManagemen return &SmartEnergyManagementPsCommonInterface_Expecter{mock: &_m.Mock} } -// GetData provides a mock function with no fields -func (_m *SmartEnergyManagementPsCommonInterface) GetData() (*model.SmartEnergyManagementPsDataType, error) { - ret := _m.Called() +// GetData provides a mock function for the type SmartEnergyManagementPsCommonInterface +func (_mock *SmartEnergyManagementPsCommonInterface) GetData() (*model.SmartEnergyManagementPsDataType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for GetData") @@ -30,23 +46,21 @@ func (_m *SmartEnergyManagementPsCommonInterface) GetData() (*model.SmartEnergyM var r0 *model.SmartEnergyManagementPsDataType var r1 error - if rf, ok := ret.Get(0).(func() (*model.SmartEnergyManagementPsDataType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (*model.SmartEnergyManagementPsDataType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() *model.SmartEnergyManagementPsDataType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() *model.SmartEnergyManagementPsDataType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.SmartEnergyManagementPsDataType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -67,8 +81,8 @@ func (_c *SmartEnergyManagementPsCommonInterface_GetData_Call) Run(run func()) * return _c } -func (_c *SmartEnergyManagementPsCommonInterface_GetData_Call) Return(_a0 *model.SmartEnergyManagementPsDataType, _a1 error) *SmartEnergyManagementPsCommonInterface_GetData_Call { - _c.Call.Return(_a0, _a1) +func (_c *SmartEnergyManagementPsCommonInterface_GetData_Call) Return(smartEnergyManagementPsDataType *model.SmartEnergyManagementPsDataType, err error) *SmartEnergyManagementPsCommonInterface_GetData_Call { + _c.Call.Return(smartEnergyManagementPsDataType, err) return _c } @@ -76,17 +90,3 @@ func (_c *SmartEnergyManagementPsCommonInterface_GetData_Call) RunAndReturn(run _c.Call.Return(run) return _c } - -// NewSmartEnergyManagementPsCommonInterface creates a new instance of SmartEnergyManagementPsCommonInterface. 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 NewSmartEnergyManagementPsCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *SmartEnergyManagementPsCommonInterface { - mock := &SmartEnergyManagementPsCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/SmartEnergyManagementPsServerInterface.go b/mocks/SmartEnergyManagementPsServerInterface.go index b7c3a323..0bee8257 100644 --- a/mocks/SmartEnergyManagementPsServerInterface.go +++ b/mocks/SmartEnergyManagementPsServerInterface.go @@ -1,21 +1,12 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks -import mock "github.com/stretchr/testify/mock" - -// SmartEnergyManagementPsServerInterface is an autogenerated mock type for the SmartEnergyManagementPsServerInterface type -type SmartEnergyManagementPsServerInterface struct { - mock.Mock -} - -type SmartEnergyManagementPsServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *SmartEnergyManagementPsServerInterface) EXPECT() *SmartEnergyManagementPsServerInterface_Expecter { - return &SmartEnergyManagementPsServerInterface_Expecter{mock: &_m.Mock} -} +import ( + mock "github.com/stretchr/testify/mock" +) // NewSmartEnergyManagementPsServerInterface creates a new instance of SmartEnergyManagementPsServerInterface. 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. @@ -30,3 +21,16 @@ func NewSmartEnergyManagementPsServerInterface(t interface { return mock } + +// SmartEnergyManagementPsServerInterface is an autogenerated mock type for the SmartEnergyManagementPsServerInterface type +type SmartEnergyManagementPsServerInterface struct { + mock.Mock +} + +type SmartEnergyManagementPsServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *SmartEnergyManagementPsServerInterface) EXPECT() *SmartEnergyManagementPsServerInterface_Expecter { + return &SmartEnergyManagementPsServerInterface_Expecter{mock: &_m.Mock} +} diff --git a/mocks/TimeSeriesClientInterface.go b/mocks/TimeSeriesClientInterface.go index 782be79b..46dc1d37 100644 --- a/mocks/TimeSeriesClientInterface.go +++ b/mocks/TimeSeriesClientInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewTimeSeriesClientInterface creates a new instance of TimeSeriesClientInterface. 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 NewTimeSeriesClientInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *TimeSeriesClientInterface { + mock := &TimeSeriesClientInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // TimeSeriesClientInterface is an autogenerated mock type for the TimeSeriesClientInterface type type TimeSeriesClientInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *TimeSeriesClientInterface) EXPECT() *TimeSeriesClientInterface_Expecte return &TimeSeriesClientInterface_Expecter{mock: &_m.Mock} } -// RequestConstraints provides a mock function with given fields: selector, elements -func (_m *TimeSeriesClientInterface) RequestConstraints(selector *model.TimeSeriesConstraintsListDataSelectorsType, elements *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestConstraints provides a mock function for the type TimeSeriesClientInterface +func (_mock *TimeSeriesClientInterface) RequestConstraints(selector *model.TimeSeriesConstraintsListDataSelectorsType, elements *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestConstraints") @@ -30,23 +46,21 @@ func (_m *TimeSeriesClientInterface) RequestConstraints(selector *model.TimeSeri var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -64,24 +78,35 @@ func (_e *TimeSeriesClientInterface_Expecter) RequestConstraints(selector interf func (_c *TimeSeriesClientInterface_RequestConstraints_Call) Run(run func(selector *model.TimeSeriesConstraintsListDataSelectorsType, elements *model.TimeSeriesConstraintsDataElementsType)) *TimeSeriesClientInterface_RequestConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.TimeSeriesConstraintsListDataSelectorsType), args[1].(*model.TimeSeriesConstraintsDataElementsType)) + var arg0 *model.TimeSeriesConstraintsListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.TimeSeriesConstraintsListDataSelectorsType) + } + var arg1 *model.TimeSeriesConstraintsDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.TimeSeriesConstraintsDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *TimeSeriesClientInterface_RequestConstraints_Call) Return(_a0 *model.MsgCounterType, _a1 error) *TimeSeriesClientInterface_RequestConstraints_Call { - _c.Call.Return(_a0, _a1) +func (_c *TimeSeriesClientInterface_RequestConstraints_Call) Return(msgCounterType *model.MsgCounterType, err error) *TimeSeriesClientInterface_RequestConstraints_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *TimeSeriesClientInterface_RequestConstraints_Call) RunAndReturn(run func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestConstraints_Call { +func (_c *TimeSeriesClientInterface_RequestConstraints_Call) RunAndReturn(run func(selector *model.TimeSeriesConstraintsListDataSelectorsType, elements *model.TimeSeriesConstraintsDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestConstraints_Call { _c.Call.Return(run) return _c } -// RequestData provides a mock function with given fields: selector, elements -func (_m *TimeSeriesClientInterface) RequestData(selector *model.TimeSeriesListDataSelectorsType, elements *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestData provides a mock function for the type TimeSeriesClientInterface +func (_mock *TimeSeriesClientInterface) RequestData(selector *model.TimeSeriesListDataSelectorsType, elements *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestData") @@ -89,23 +114,21 @@ func (_m *TimeSeriesClientInterface) RequestData(selector *model.TimeSeriesListD var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -123,24 +146,35 @@ func (_e *TimeSeriesClientInterface_Expecter) RequestData(selector interface{}, func (_c *TimeSeriesClientInterface_RequestData_Call) Run(run func(selector *model.TimeSeriesListDataSelectorsType, elements *model.TimeSeriesDataElementsType)) *TimeSeriesClientInterface_RequestData_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.TimeSeriesListDataSelectorsType), args[1].(*model.TimeSeriesDataElementsType)) + var arg0 *model.TimeSeriesListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.TimeSeriesListDataSelectorsType) + } + var arg1 *model.TimeSeriesDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.TimeSeriesDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *TimeSeriesClientInterface_RequestData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *TimeSeriesClientInterface_RequestData_Call { - _c.Call.Return(_a0, _a1) +func (_c *TimeSeriesClientInterface_RequestData_Call) Return(msgCounterType *model.MsgCounterType, err error) *TimeSeriesClientInterface_RequestData_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *TimeSeriesClientInterface_RequestData_Call) RunAndReturn(run func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestData_Call { +func (_c *TimeSeriesClientInterface_RequestData_Call) RunAndReturn(run func(selector *model.TimeSeriesListDataSelectorsType, elements *model.TimeSeriesDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestData_Call { _c.Call.Return(run) return _c } -// RequestDescriptions provides a mock function with given fields: selector, elements -func (_m *TimeSeriesClientInterface) RequestDescriptions(selector *model.TimeSeriesDescriptionListDataSelectorsType, elements *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error) { - ret := _m.Called(selector, elements) +// RequestDescriptions provides a mock function for the type TimeSeriesClientInterface +func (_mock *TimeSeriesClientInterface) RequestDescriptions(selector *model.TimeSeriesDescriptionListDataSelectorsType, elements *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error) { + ret := _mock.Called(selector, elements) if len(ret) == 0 { panic("no return value specified for RequestDescriptions") @@ -148,23 +182,21 @@ func (_m *TimeSeriesClientInterface) RequestDescriptions(selector *model.TimeSer var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { - return rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error)); ok { + return returnFunc(selector, elements) } - if rf, ok := ret.Get(0).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) *model.MsgCounterType); ok { - r0 = rf(selector, elements) + if returnFunc, ok := ret.Get(0).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) *model.MsgCounterType); ok { + r0 = returnFunc(selector, elements) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) error); ok { - r1 = rf(selector, elements) + if returnFunc, ok := ret.Get(1).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) error); ok { + r1 = returnFunc(selector, elements) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -182,24 +214,35 @@ func (_e *TimeSeriesClientInterface_Expecter) RequestDescriptions(selector inter func (_c *TimeSeriesClientInterface_RequestDescriptions_Call) Run(run func(selector *model.TimeSeriesDescriptionListDataSelectorsType, elements *model.TimeSeriesDescriptionDataElementsType)) *TimeSeriesClientInterface_RequestDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*model.TimeSeriesDescriptionListDataSelectorsType), args[1].(*model.TimeSeriesDescriptionDataElementsType)) + var arg0 *model.TimeSeriesDescriptionListDataSelectorsType + if args[0] != nil { + arg0 = args[0].(*model.TimeSeriesDescriptionListDataSelectorsType) + } + var arg1 *model.TimeSeriesDescriptionDataElementsType + if args[1] != nil { + arg1 = args[1].(*model.TimeSeriesDescriptionDataElementsType) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *TimeSeriesClientInterface_RequestDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *TimeSeriesClientInterface_RequestDescriptions_Call { - _c.Call.Return(_a0, _a1) +func (_c *TimeSeriesClientInterface_RequestDescriptions_Call) Return(msgCounterType *model.MsgCounterType, err error) *TimeSeriesClientInterface_RequestDescriptions_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *TimeSeriesClientInterface_RequestDescriptions_Call) RunAndReturn(run func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestDescriptions_Call { +func (_c *TimeSeriesClientInterface_RequestDescriptions_Call) RunAndReturn(run func(selector *model.TimeSeriesDescriptionListDataSelectorsType, elements *model.TimeSeriesDescriptionDataElementsType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_RequestDescriptions_Call { _c.Call.Return(run) return _c } -// WriteData provides a mock function with given fields: data -func (_m *TimeSeriesClientInterface) WriteData(data []model.TimeSeriesDataType) (*model.MsgCounterType, error) { - ret := _m.Called(data) +// WriteData provides a mock function for the type TimeSeriesClientInterface +func (_mock *TimeSeriesClientInterface) WriteData(data []model.TimeSeriesDataType) (*model.MsgCounterType, error) { + ret := _mock.Called(data) if len(ret) == 0 { panic("no return value specified for WriteData") @@ -207,23 +250,21 @@ func (_m *TimeSeriesClientInterface) WriteData(data []model.TimeSeriesDataType) var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func([]model.TimeSeriesDataType) (*model.MsgCounterType, error)); ok { - return rf(data) + if returnFunc, ok := ret.Get(0).(func([]model.TimeSeriesDataType) (*model.MsgCounterType, error)); ok { + return returnFunc(data) } - if rf, ok := ret.Get(0).(func([]model.TimeSeriesDataType) *model.MsgCounterType); ok { - r0 = rf(data) + if returnFunc, ok := ret.Get(0).(func([]model.TimeSeriesDataType) *model.MsgCounterType); ok { + r0 = returnFunc(data) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func([]model.TimeSeriesDataType) error); ok { - r1 = rf(data) + if returnFunc, ok := ret.Get(1).(func([]model.TimeSeriesDataType) error); ok { + r1 = returnFunc(data) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -240,31 +281,23 @@ func (_e *TimeSeriesClientInterface_Expecter) WriteData(data interface{}) *TimeS func (_c *TimeSeriesClientInterface_WriteData_Call) Run(run func(data []model.TimeSeriesDataType)) *TimeSeriesClientInterface_WriteData_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]model.TimeSeriesDataType)) + var arg0 []model.TimeSeriesDataType + if args[0] != nil { + arg0 = args[0].([]model.TimeSeriesDataType) + } + run( + arg0, + ) }) return _c } -func (_c *TimeSeriesClientInterface_WriteData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *TimeSeriesClientInterface_WriteData_Call { - _c.Call.Return(_a0, _a1) +func (_c *TimeSeriesClientInterface_WriteData_Call) Return(msgCounterType *model.MsgCounterType, err error) *TimeSeriesClientInterface_WriteData_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *TimeSeriesClientInterface_WriteData_Call) RunAndReturn(run func([]model.TimeSeriesDataType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_WriteData_Call { +func (_c *TimeSeriesClientInterface_WriteData_Call) RunAndReturn(run func(data []model.TimeSeriesDataType) (*model.MsgCounterType, error)) *TimeSeriesClientInterface_WriteData_Call { _c.Call.Return(run) return _c } - -// NewTimeSeriesClientInterface creates a new instance of TimeSeriesClientInterface. 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 NewTimeSeriesClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *TimeSeriesClientInterface { - mock := &TimeSeriesClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/TimeSeriesCommonInterface.go b/mocks/TimeSeriesCommonInterface.go index 11a84d43..e816686e 100644 --- a/mocks/TimeSeriesCommonInterface.go +++ b/mocks/TimeSeriesCommonInterface.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - model "github.com/enbility/spine-go/model" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" ) +// NewTimeSeriesCommonInterface creates a new instance of TimeSeriesCommonInterface. 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 NewTimeSeriesCommonInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *TimeSeriesCommonInterface { + mock := &TimeSeriesCommonInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // TimeSeriesCommonInterface is an autogenerated mock type for the TimeSeriesCommonInterface type type TimeSeriesCommonInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *TimeSeriesCommonInterface) EXPECT() *TimeSeriesCommonInterface_Expecte return &TimeSeriesCommonInterface_Expecter{mock: &_m.Mock} } -// GetConstraints provides a mock function with no fields -func (_m *TimeSeriesCommonInterface) GetConstraints() ([]model.TimeSeriesConstraintsDataType, error) { - ret := _m.Called() +// GetConstraints provides a mock function for the type TimeSeriesCommonInterface +func (_mock *TimeSeriesCommonInterface) GetConstraints() ([]model.TimeSeriesConstraintsDataType, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for GetConstraints") @@ -30,23 +46,21 @@ func (_m *TimeSeriesCommonInterface) GetConstraints() ([]model.TimeSeriesConstra var r0 []model.TimeSeriesConstraintsDataType var r1 error - if rf, ok := ret.Get(0).(func() ([]model.TimeSeriesConstraintsDataType, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() ([]model.TimeSeriesConstraintsDataType, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() []model.TimeSeriesConstraintsDataType); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() []model.TimeSeriesConstraintsDataType); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.TimeSeriesConstraintsDataType) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -67,8 +81,8 @@ func (_c *TimeSeriesCommonInterface_GetConstraints_Call) Run(run func()) *TimeSe return _c } -func (_c *TimeSeriesCommonInterface_GetConstraints_Call) Return(_a0 []model.TimeSeriesConstraintsDataType, _a1 error) *TimeSeriesCommonInterface_GetConstraints_Call { - _c.Call.Return(_a0, _a1) +func (_c *TimeSeriesCommonInterface_GetConstraints_Call) Return(timeSeriesConstraintsDataTypes []model.TimeSeriesConstraintsDataType, err error) *TimeSeriesCommonInterface_GetConstraints_Call { + _c.Call.Return(timeSeriesConstraintsDataTypes, err) return _c } @@ -77,9 +91,9 @@ func (_c *TimeSeriesCommonInterface_GetConstraints_Call) RunAndReturn(run func() return _c } -// GetDataForFilter provides a mock function with given fields: filter -func (_m *TimeSeriesCommonInterface) GetDataForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error) { - ret := _m.Called(filter) +// GetDataForFilter provides a mock function for the type TimeSeriesCommonInterface +func (_mock *TimeSeriesCommonInterface) GetDataForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDataForFilter") @@ -87,23 +101,21 @@ func (_m *TimeSeriesCommonInterface) GetDataForFilter(filter model.TimeSeriesDes var r0 []model.TimeSeriesDataType var r1 error - if rf, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) []model.TimeSeriesDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) []model.TimeSeriesDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.TimeSeriesDataType) } } - - if rf, ok := ret.Get(1).(func(model.TimeSeriesDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.TimeSeriesDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -120,24 +132,30 @@ func (_e *TimeSeriesCommonInterface_Expecter) GetDataForFilter(filter interface{ func (_c *TimeSeriesCommonInterface_GetDataForFilter_Call) Run(run func(filter model.TimeSeriesDescriptionDataType)) *TimeSeriesCommonInterface_GetDataForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.TimeSeriesDescriptionDataType)) + var arg0 model.TimeSeriesDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.TimeSeriesDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *TimeSeriesCommonInterface_GetDataForFilter_Call) Return(_a0 []model.TimeSeriesDataType, _a1 error) *TimeSeriesCommonInterface_GetDataForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *TimeSeriesCommonInterface_GetDataForFilter_Call) Return(timeSeriesDataTypes []model.TimeSeriesDataType, err error) *TimeSeriesCommonInterface_GetDataForFilter_Call { + _c.Call.Return(timeSeriesDataTypes, err) return _c } -func (_c *TimeSeriesCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)) *TimeSeriesCommonInterface_GetDataForFilter_Call { +func (_c *TimeSeriesCommonInterface_GetDataForFilter_Call) RunAndReturn(run func(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)) *TimeSeriesCommonInterface_GetDataForFilter_Call { _c.Call.Return(run) return _c } -// GetDescriptionsForFilter provides a mock function with given fields: filter -func (_m *TimeSeriesCommonInterface) GetDescriptionsForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error) { - ret := _m.Called(filter) +// GetDescriptionsForFilter provides a mock function for the type TimeSeriesCommonInterface +func (_mock *TimeSeriesCommonInterface) GetDescriptionsForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error) { + ret := _mock.Called(filter) if len(ret) == 0 { panic("no return value specified for GetDescriptionsForFilter") @@ -145,23 +163,21 @@ func (_m *TimeSeriesCommonInterface) GetDescriptionsForFilter(filter model.TimeS var r0 []model.TimeSeriesDescriptionDataType var r1 error - if rf, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)); ok { - return rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)); ok { + return returnFunc(filter) } - if rf, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) []model.TimeSeriesDescriptionDataType); ok { - r0 = rf(filter) + if returnFunc, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) []model.TimeSeriesDescriptionDataType); ok { + r0 = returnFunc(filter) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]model.TimeSeriesDescriptionDataType) } } - - if rf, ok := ret.Get(1).(func(model.TimeSeriesDescriptionDataType) error); ok { - r1 = rf(filter) + if returnFunc, ok := ret.Get(1).(func(model.TimeSeriesDescriptionDataType) error); ok { + r1 = returnFunc(filter) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -178,31 +194,23 @@ func (_e *TimeSeriesCommonInterface_Expecter) GetDescriptionsForFilter(filter in func (_c *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call) Run(run func(filter model.TimeSeriesDescriptionDataType)) *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.TimeSeriesDescriptionDataType)) + var arg0 model.TimeSeriesDescriptionDataType + if args[0] != nil { + arg0 = args[0].(model.TimeSeriesDescriptionDataType) + } + run( + arg0, + ) }) return _c } -func (_c *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call) Return(_a0 []model.TimeSeriesDescriptionDataType, _a1 error) *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call { - _c.Call.Return(_a0, _a1) +func (_c *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call) Return(timeSeriesDescriptionDataTypes []model.TimeSeriesDescriptionDataType, err error) *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call { + _c.Call.Return(timeSeriesDescriptionDataTypes, err) return _c } -func (_c *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)) *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call { +func (_c *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call) RunAndReturn(run func(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)) *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call { _c.Call.Return(run) return _c } - -// NewTimeSeriesCommonInterface creates a new instance of TimeSeriesCommonInterface. 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 NewTimeSeriesCommonInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *TimeSeriesCommonInterface { - mock := &TimeSeriesCommonInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/TimeSeriesServerInterface.go b/mocks/TimeSeriesServerInterface.go index 13623fff..78248483 100644 --- a/mocks/TimeSeriesServerInterface.go +++ b/mocks/TimeSeriesServerInterface.go @@ -1,21 +1,12 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks -import mock "github.com/stretchr/testify/mock" - -// TimeSeriesServerInterface is an autogenerated mock type for the TimeSeriesServerInterface type -type TimeSeriesServerInterface struct { - mock.Mock -} - -type TimeSeriesServerInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *TimeSeriesServerInterface) EXPECT() *TimeSeriesServerInterface_Expecter { - return &TimeSeriesServerInterface_Expecter{mock: &_m.Mock} -} +import ( + mock "github.com/stretchr/testify/mock" +) // NewTimeSeriesServerInterface creates a new instance of TimeSeriesServerInterface. 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. @@ -30,3 +21,16 @@ func NewTimeSeriesServerInterface(t interface { return mock } + +// TimeSeriesServerInterface is an autogenerated mock type for the TimeSeriesServerInterface type +type TimeSeriesServerInterface struct { + mock.Mock +} + +type TimeSeriesServerInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *TimeSeriesServerInterface) EXPECT() *TimeSeriesServerInterface_Expecter { + return &TimeSeriesServerInterface_Expecter{mock: &_m.Mock} +} diff --git a/mocks/UseCaseBaseInterface.go b/mocks/UseCaseBaseInterface.go index bc669948..e454ded4 100644 --- a/mocks/UseCaseBaseInterface.go +++ b/mocks/UseCaseBaseInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - api "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/api" mock "github.com/stretchr/testify/mock" - - spine_goapi "github.com/enbility/spine-go/api" ) +// NewUseCaseBaseInterface creates a new instance of UseCaseBaseInterface. 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 NewUseCaseBaseInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *UseCaseBaseInterface { + mock := &UseCaseBaseInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // UseCaseBaseInterface is an autogenerated mock type for the UseCaseBaseInterface type type UseCaseBaseInterface struct { mock.Mock @@ -22,9 +37,10 @@ func (_m *UseCaseBaseInterface) EXPECT() *UseCaseBaseInterface_Expecter { return &UseCaseBaseInterface_Expecter{mock: &_m.Mock} } -// AddUseCase provides a mock function with no fields -func (_m *UseCaseBaseInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type UseCaseBaseInterface +func (_mock *UseCaseBaseInterface) AddUseCase() { + _mock.Called() + return } // UseCaseBaseInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -54,23 +70,22 @@ func (_c *UseCaseBaseInterface_AddUseCase_Call) RunAndReturn(run func()) *UseCas return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *UseCaseBaseInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type UseCaseBaseInterface +func (_mock *UseCaseBaseInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -80,43 +95,48 @@ type UseCaseBaseInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *UseCaseBaseInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { return &UseCaseBaseInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { +func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { +func (_c *UseCaseBaseInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *UseCaseBaseInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *UseCaseBaseInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type UseCaseBaseInterface +func (_mock *UseCaseBaseInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -126,43 +146,48 @@ type UseCaseBaseInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *UseCaseBaseInterface_Expecter) IsCompatibleEntityType(entity interface{}) *UseCaseBaseInterface_IsCompatibleEntityType_Call { return &UseCaseBaseInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *UseCaseBaseInterface_IsCompatibleEntityType_Call { +func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *UseCaseBaseInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *UseCaseBaseInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) Return(b bool) *UseCaseBaseInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *UseCaseBaseInterface_IsCompatibleEntityType_Call { +func (_c *UseCaseBaseInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *UseCaseBaseInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *UseCaseBaseInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type UseCaseBaseInterface +func (_mock *UseCaseBaseInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -172,46 +197,56 @@ type UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *UseCaseBaseInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { return &UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { +func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { +func (_c *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *UseCaseBaseInterface) RemoteEntitiesScenarios() []api.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type UseCaseBaseInterface +func (_mock *UseCaseBaseInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []api.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api0.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api.RemoteEntityScenarios) + r0 = ret.Get(0).([]api0.RemoteEntityScenarios) } } - return r0 } @@ -232,19 +267,20 @@ func (_c *UseCaseBaseInterface_RemoteEntitiesScenarios_Call) Run(run func()) *Us return _c } -func (_c *UseCaseBaseInterface_RemoteEntitiesScenarios_Call) Return(_a0 []api.RemoteEntityScenarios) *UseCaseBaseInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *UseCaseBaseInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *UseCaseBaseInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *UseCaseBaseInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api.RemoteEntityScenarios) *UseCaseBaseInterface_RemoteEntitiesScenarios_Call { +func (_c *UseCaseBaseInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *UseCaseBaseInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *UseCaseBaseInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type UseCaseBaseInterface +func (_mock *UseCaseBaseInterface) RemoveUseCase() { + _mock.Called() + return } // UseCaseBaseInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -274,9 +310,10 @@ func (_c *UseCaseBaseInterface_RemoveUseCase_Call) RunAndReturn(run func()) *Use return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *UseCaseBaseInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type UseCaseBaseInterface +func (_mock *UseCaseBaseInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // UseCaseBaseInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -292,7 +329,13 @@ func (_e *UseCaseBaseInterface_Expecter) UpdateUseCaseAvailability(available int func (_c *UseCaseBaseInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *UseCaseBaseInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -302,21 +345,7 @@ func (_c *UseCaseBaseInterface_UpdateUseCaseAvailability_Call) Return() *UseCase return _c } -func (_c *UseCaseBaseInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *UseCaseBaseInterface_UpdateUseCaseAvailability_Call { +func (_c *UseCaseBaseInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *UseCaseBaseInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } - -// NewUseCaseBaseInterface creates a new instance of UseCaseBaseInterface. 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 NewUseCaseBaseInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *UseCaseBaseInterface { - mock := &UseCaseBaseInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/UseCaseInterface.go b/mocks/UseCaseInterface.go index 3f52ca9f..308ef381 100644 --- a/mocks/UseCaseInterface.go +++ b/mocks/UseCaseInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - api "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/api" mock "github.com/stretchr/testify/mock" - - spine_goapi "github.com/enbility/spine-go/api" ) +// NewUseCaseInterface creates a new instance of UseCaseInterface. 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 NewUseCaseInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *UseCaseInterface { + mock := &UseCaseInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // UseCaseInterface is an autogenerated mock type for the UseCaseInterface type type UseCaseInterface struct { mock.Mock @@ -22,21 +37,20 @@ func (_m *UseCaseInterface) EXPECT() *UseCaseInterface_Expecter { return &UseCaseInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *UseCaseInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type UseCaseInterface +func (_mock *UseCaseInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -57,8 +71,8 @@ func (_c *UseCaseInterface_AddFeatures_Call) Run(run func()) *UseCaseInterface_A return _c } -func (_c *UseCaseInterface_AddFeatures_Call) Return(_a0 error) *UseCaseInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *UseCaseInterface_AddFeatures_Call) Return(err error) *UseCaseInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -67,9 +81,10 @@ func (_c *UseCaseInterface_AddFeatures_Call) RunAndReturn(run func() error) *Use return _c } -// AddUseCase provides a mock function with no fields -func (_m *UseCaseInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type UseCaseInterface +func (_mock *UseCaseInterface) AddUseCase() { + _mock.Called() + return } // UseCaseInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -99,23 +114,22 @@ func (_c *UseCaseInterface_AddUseCase_Call) RunAndReturn(run func()) *UseCaseInt return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *UseCaseInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type UseCaseInterface +func (_mock *UseCaseInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -125,43 +139,48 @@ type UseCaseInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *UseCaseInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *UseCaseInterface_AvailableScenariosForEntity_Call { return &UseCaseInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *UseCaseInterface_AvailableScenariosForEntity_Call { +func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *UseCaseInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *UseCaseInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *UseCaseInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *UseCaseInterface_AvailableScenariosForEntity_Call { +func (_c *UseCaseInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *UseCaseInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *UseCaseInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type UseCaseInterface +func (_mock *UseCaseInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -171,43 +190,48 @@ type UseCaseInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *UseCaseInterface_Expecter) IsCompatibleEntityType(entity interface{}) *UseCaseInterface_IsCompatibleEntityType_Call { return &UseCaseInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *UseCaseInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *UseCaseInterface_IsCompatibleEntityType_Call { +func (_c *UseCaseInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *UseCaseInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *UseCaseInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *UseCaseInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *UseCaseInterface_IsCompatibleEntityType_Call) Return(b bool) *UseCaseInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *UseCaseInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *UseCaseInterface_IsCompatibleEntityType_Call { +func (_c *UseCaseInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *UseCaseInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *UseCaseInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type UseCaseInterface +func (_mock *UseCaseInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -217,46 +241,56 @@ type UseCaseInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *UseCaseInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { return &UseCaseInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { +func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { +func (_c *UseCaseInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *UseCaseInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *UseCaseInterface) RemoteEntitiesScenarios() []api.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type UseCaseInterface +func (_mock *UseCaseInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []api.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []api.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api0.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api.RemoteEntityScenarios) + r0 = ret.Get(0).([]api0.RemoteEntityScenarios) } } - return r0 } @@ -277,19 +311,20 @@ func (_c *UseCaseInterface_RemoteEntitiesScenarios_Call) Run(run func()) *UseCas return _c } -func (_c *UseCaseInterface_RemoteEntitiesScenarios_Call) Return(_a0 []api.RemoteEntityScenarios) *UseCaseInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *UseCaseInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *UseCaseInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *UseCaseInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api.RemoteEntityScenarios) *UseCaseInterface_RemoteEntitiesScenarios_Call { +func (_c *UseCaseInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *UseCaseInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *UseCaseInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type UseCaseInterface +func (_mock *UseCaseInterface) RemoveUseCase() { + _mock.Called() + return } // UseCaseInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -319,9 +354,10 @@ func (_c *UseCaseInterface_RemoveUseCase_Call) RunAndReturn(run func()) *UseCase return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *UseCaseInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type UseCaseInterface +func (_mock *UseCaseInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // UseCaseInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -337,7 +373,13 @@ func (_e *UseCaseInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *UseCaseInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *UseCaseInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -347,21 +389,7 @@ func (_c *UseCaseInterface_UpdateUseCaseAvailability_Call) Return() *UseCaseInte return _c } -func (_c *UseCaseInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *UseCaseInterface_UpdateUseCaseAvailability_Call { +func (_c *UseCaseInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *UseCaseInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } - -// NewUseCaseInterface creates a new instance of UseCaseInterface. 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 NewUseCaseInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *UseCaseInterface { - mock := &UseCaseInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/CemCEVCInterface.go b/usecases/mocks/CemCEVCInterface.go index 33ecd02f..b317cfa0 100644 --- a/usecases/mocks/CemCEVCInterface.go +++ b/usecases/mocks/CemCEVCInterface.go @@ -1,16 +1,30 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" - api "github.com/enbility/eebus-go/usecases/api" - + api1 "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/api" mock "github.com/stretchr/testify/mock" - - spine_goapi "github.com/enbility/spine-go/api" ) +// NewCemCEVCInterface creates a new instance of CemCEVCInterface. 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 NewCemCEVCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemCEVCInterface { + mock := &CemCEVCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // CemCEVCInterface is an autogenerated mock type for the CemCEVCInterface type type CemCEVCInterface struct { mock.Mock @@ -24,21 +38,20 @@ func (_m *CemCEVCInterface) EXPECT() *CemCEVCInterface_Expecter { return &CemCEVCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *CemCEVCInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -59,8 +72,8 @@ func (_c *CemCEVCInterface_AddFeatures_Call) Run(run func()) *CemCEVCInterface_A return _c } -func (_c *CemCEVCInterface_AddFeatures_Call) Return(_a0 error) *CemCEVCInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *CemCEVCInterface_AddFeatures_Call) Return(err error) *CemCEVCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -69,9 +82,10 @@ func (_c *CemCEVCInterface_AddFeatures_Call) RunAndReturn(run func() error) *Cem return _c } -// AddUseCase provides a mock function with no fields -func (_m *CemCEVCInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) AddUseCase() { + _mock.Called() + return } // CemCEVCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -101,23 +115,22 @@ func (_c *CemCEVCInterface_AddUseCase_Call) RunAndReturn(run func()) *CemCEVCInt return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *CemCEVCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -127,53 +140,57 @@ type CemCEVCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemCEVCInterface_AvailableScenariosForEntity_Call { return &CemCEVCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_AvailableScenariosForEntity_Call { +func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemCEVCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemCEVCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemCEVCInterface_AvailableScenariosForEntity_Call { +func (_c *CemCEVCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemCEVCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// ChargePlan provides a mock function with given fields: entity -func (_m *CemCEVCInterface) ChargePlan(entity spine_goapi.EntityRemoteInterface) (api.ChargePlan, error) { - ret := _m.Called(entity) +// ChargePlan provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) ChargePlan(entity api.EntityRemoteInterface) (api0.ChargePlan, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for ChargePlan") } - var r0 api.ChargePlan + var r0 api0.ChargePlan var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.ChargePlan, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.ChargePlan, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.ChargePlan); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.ChargePlan); ok { + r0 = returnFunc(entity) } else { - r0 = ret.Get(0).(api.ChargePlan) + r0 = ret.Get(0).(api0.ChargePlan) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -183,55 +200,59 @@ type CemCEVCInterface_ChargePlan_Call struct { } // ChargePlan is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) ChargePlan(entity interface{}) *CemCEVCInterface_ChargePlan_Call { return &CemCEVCInterface_ChargePlan_Call{Call: _e.mock.On("ChargePlan", entity)} } -func (_c *CemCEVCInterface_ChargePlan_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_ChargePlan_Call { +func (_c *CemCEVCInterface_ChargePlan_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_ChargePlan_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemCEVCInterface_ChargePlan_Call) Return(_a0 api.ChargePlan, _a1 error) *CemCEVCInterface_ChargePlan_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemCEVCInterface_ChargePlan_Call) Return(chargePlan api0.ChargePlan, err error) *CemCEVCInterface_ChargePlan_Call { + _c.Call.Return(chargePlan, err) return _c } -func (_c *CemCEVCInterface_ChargePlan_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.ChargePlan, error)) *CemCEVCInterface_ChargePlan_Call { +func (_c *CemCEVCInterface_ChargePlan_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.ChargePlan, error)) *CemCEVCInterface_ChargePlan_Call { _c.Call.Return(run) return _c } -// ChargePlanConstraints provides a mock function with given fields: entity -func (_m *CemCEVCInterface) ChargePlanConstraints(entity spine_goapi.EntityRemoteInterface) ([]api.DurationSlotValue, error) { - ret := _m.Called(entity) +// ChargePlanConstraints provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) ChargePlanConstraints(entity api.EntityRemoteInterface) ([]api0.DurationSlotValue, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for ChargePlanConstraints") } - var r0 []api.DurationSlotValue + var r0 []api0.DurationSlotValue var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]api.DurationSlotValue, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]api0.DurationSlotValue, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []api.DurationSlotValue); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []api0.DurationSlotValue); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api.DurationSlotValue) + r0 = ret.Get(0).([]api0.DurationSlotValue) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -241,43 +262,48 @@ type CemCEVCInterface_ChargePlanConstraints_Call struct { } // ChargePlanConstraints is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) ChargePlanConstraints(entity interface{}) *CemCEVCInterface_ChargePlanConstraints_Call { return &CemCEVCInterface_ChargePlanConstraints_Call{Call: _e.mock.On("ChargePlanConstraints", entity)} } -func (_c *CemCEVCInterface_ChargePlanConstraints_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_ChargePlanConstraints_Call { +func (_c *CemCEVCInterface_ChargePlanConstraints_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_ChargePlanConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemCEVCInterface_ChargePlanConstraints_Call) Return(_a0 []api.DurationSlotValue, _a1 error) *CemCEVCInterface_ChargePlanConstraints_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemCEVCInterface_ChargePlanConstraints_Call) Return(durationSlotValues []api0.DurationSlotValue, err error) *CemCEVCInterface_ChargePlanConstraints_Call { + _c.Call.Return(durationSlotValues, err) return _c } -func (_c *CemCEVCInterface_ChargePlanConstraints_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]api.DurationSlotValue, error)) *CemCEVCInterface_ChargePlanConstraints_Call { +func (_c *CemCEVCInterface_ChargePlanConstraints_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]api0.DurationSlotValue, error)) *CemCEVCInterface_ChargePlanConstraints_Call { _c.Call.Return(run) return _c } -// ChargeStrategy provides a mock function with given fields: remoteEntity -func (_m *CemCEVCInterface) ChargeStrategy(remoteEntity spine_goapi.EntityRemoteInterface) api.EVChargeStrategyType { - ret := _m.Called(remoteEntity) +// ChargeStrategy provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) ChargeStrategy(remoteEntity api.EntityRemoteInterface) api0.EVChargeStrategyType { + ret := _mock.Called(remoteEntity) if len(ret) == 0 { panic("no return value specified for ChargeStrategy") } - var r0 api.EVChargeStrategyType - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.EVChargeStrategyType); ok { - r0 = rf(remoteEntity) + var r0 api0.EVChargeStrategyType + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.EVChargeStrategyType); ok { + r0 = returnFunc(remoteEntity) } else { - r0 = ret.Get(0).(api.EVChargeStrategyType) + r0 = ret.Get(0).(api0.EVChargeStrategyType) } - return r0 } @@ -287,53 +313,57 @@ type CemCEVCInterface_ChargeStrategy_Call struct { } // ChargeStrategy is a helper method to define mock.On call -// - remoteEntity spine_goapi.EntityRemoteInterface +// - remoteEntity api.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) ChargeStrategy(remoteEntity interface{}) *CemCEVCInterface_ChargeStrategy_Call { return &CemCEVCInterface_ChargeStrategy_Call{Call: _e.mock.On("ChargeStrategy", remoteEntity)} } -func (_c *CemCEVCInterface_ChargeStrategy_Call) Run(run func(remoteEntity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_ChargeStrategy_Call { +func (_c *CemCEVCInterface_ChargeStrategy_Call) Run(run func(remoteEntity api.EntityRemoteInterface)) *CemCEVCInterface_ChargeStrategy_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemCEVCInterface_ChargeStrategy_Call) Return(_a0 api.EVChargeStrategyType) *CemCEVCInterface_ChargeStrategy_Call { - _c.Call.Return(_a0) +func (_c *CemCEVCInterface_ChargeStrategy_Call) Return(eVChargeStrategyType api0.EVChargeStrategyType) *CemCEVCInterface_ChargeStrategy_Call { + _c.Call.Return(eVChargeStrategyType) return _c } -func (_c *CemCEVCInterface_ChargeStrategy_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) api.EVChargeStrategyType) *CemCEVCInterface_ChargeStrategy_Call { +func (_c *CemCEVCInterface_ChargeStrategy_Call) RunAndReturn(run func(remoteEntity api.EntityRemoteInterface) api0.EVChargeStrategyType) *CemCEVCInterface_ChargeStrategy_Call { _c.Call.Return(run) return _c } -// EnergyDemand provides a mock function with given fields: remoteEntity -func (_m *CemCEVCInterface) EnergyDemand(remoteEntity spine_goapi.EntityRemoteInterface) (api.Demand, error) { - ret := _m.Called(remoteEntity) +// EnergyDemand provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) EnergyDemand(remoteEntity api.EntityRemoteInterface) (api0.Demand, error) { + ret := _mock.Called(remoteEntity) if len(ret) == 0 { panic("no return value specified for EnergyDemand") } - var r0 api.Demand + var r0 api0.Demand var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.Demand, error)); ok { - return rf(remoteEntity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.Demand, error)); ok { + return returnFunc(remoteEntity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.Demand); ok { - r0 = rf(remoteEntity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.Demand); ok { + r0 = returnFunc(remoteEntity) } else { - r0 = ret.Get(0).(api.Demand) + r0 = ret.Get(0).(api0.Demand) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(remoteEntity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(remoteEntity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -343,53 +373,57 @@ type CemCEVCInterface_EnergyDemand_Call struct { } // EnergyDemand is a helper method to define mock.On call -// - remoteEntity spine_goapi.EntityRemoteInterface +// - remoteEntity api.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) EnergyDemand(remoteEntity interface{}) *CemCEVCInterface_EnergyDemand_Call { return &CemCEVCInterface_EnergyDemand_Call{Call: _e.mock.On("EnergyDemand", remoteEntity)} } -func (_c *CemCEVCInterface_EnergyDemand_Call) Run(run func(remoteEntity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_EnergyDemand_Call { +func (_c *CemCEVCInterface_EnergyDemand_Call) Run(run func(remoteEntity api.EntityRemoteInterface)) *CemCEVCInterface_EnergyDemand_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemCEVCInterface_EnergyDemand_Call) Return(_a0 api.Demand, _a1 error) *CemCEVCInterface_EnergyDemand_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemCEVCInterface_EnergyDemand_Call) Return(demand api0.Demand, err error) *CemCEVCInterface_EnergyDemand_Call { + _c.Call.Return(demand, err) return _c } -func (_c *CemCEVCInterface_EnergyDemand_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.Demand, error)) *CemCEVCInterface_EnergyDemand_Call { +func (_c *CemCEVCInterface_EnergyDemand_Call) RunAndReturn(run func(remoteEntity api.EntityRemoteInterface) (api0.Demand, error)) *CemCEVCInterface_EnergyDemand_Call { _c.Call.Return(run) return _c } -// IncentiveConstraints provides a mock function with given fields: entity -func (_m *CemCEVCInterface) IncentiveConstraints(entity spine_goapi.EntityRemoteInterface) (api.IncentiveSlotConstraints, error) { - ret := _m.Called(entity) +// IncentiveConstraints provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) IncentiveConstraints(entity api.EntityRemoteInterface) (api0.IncentiveSlotConstraints, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IncentiveConstraints") } - var r0 api.IncentiveSlotConstraints + var r0 api0.IncentiveSlotConstraints var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.IncentiveSlotConstraints, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.IncentiveSlotConstraints, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.IncentiveSlotConstraints); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.IncentiveSlotConstraints); ok { + r0 = returnFunc(entity) } else { - r0 = ret.Get(0).(api.IncentiveSlotConstraints) + r0 = ret.Get(0).(api0.IncentiveSlotConstraints) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -399,43 +433,48 @@ type CemCEVCInterface_IncentiveConstraints_Call struct { } // IncentiveConstraints is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) IncentiveConstraints(entity interface{}) *CemCEVCInterface_IncentiveConstraints_Call { return &CemCEVCInterface_IncentiveConstraints_Call{Call: _e.mock.On("IncentiveConstraints", entity)} } -func (_c *CemCEVCInterface_IncentiveConstraints_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_IncentiveConstraints_Call { +func (_c *CemCEVCInterface_IncentiveConstraints_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_IncentiveConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemCEVCInterface_IncentiveConstraints_Call) Return(_a0 api.IncentiveSlotConstraints, _a1 error) *CemCEVCInterface_IncentiveConstraints_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemCEVCInterface_IncentiveConstraints_Call) Return(incentiveSlotConstraints api0.IncentiveSlotConstraints, err error) *CemCEVCInterface_IncentiveConstraints_Call { + _c.Call.Return(incentiveSlotConstraints, err) return _c } -func (_c *CemCEVCInterface_IncentiveConstraints_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.IncentiveSlotConstraints, error)) *CemCEVCInterface_IncentiveConstraints_Call { +func (_c *CemCEVCInterface_IncentiveConstraints_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.IncentiveSlotConstraints, error)) *CemCEVCInterface_IncentiveConstraints_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *CemCEVCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -445,43 +484,48 @@ type CemCEVCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemCEVCInterface_IsCompatibleEntityType_Call { return &CemCEVCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_IsCompatibleEntityType_Call { +func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemCEVCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) Return(b bool) *CemCEVCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemCEVCInterface_IsCompatibleEntityType_Call { +func (_c *CemCEVCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemCEVCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *CemCEVCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -491,46 +535,56 @@ type CemCEVCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *CemCEVCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { return &CemCEVCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemCEVCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemCEVCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *CemCEVCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api1.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api1.RemoteEntityScenarios) } } - return r0 } @@ -551,19 +605,20 @@ func (_c *CemCEVCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemCEV return _c } -func (_c *CemCEVCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemCEVCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *CemCEVCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CemCEVCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *CemCEVCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemCEVCInterface_RemoteEntitiesScenarios_Call { +func (_c *CemCEVCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CemCEVCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *CemCEVCInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) RemoveUseCase() { + _mock.Called() + return } // CemCEVCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -593,21 +648,20 @@ func (_c *CemCEVCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemCEVC return _c } -// SetOperatingState provides a mock function with given fields: failureState -func (_m *CemCEVCInterface) SetOperatingState(failureState bool) error { - ret := _m.Called(failureState) +// SetOperatingState provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) SetOperatingState(failureState bool) error { + ret := _mock.Called(failureState) if len(ret) == 0 { panic("no return value specified for SetOperatingState") } var r0 error - if rf, ok := ret.Get(0).(func(bool) error); ok { - r0 = rf(failureState) + if returnFunc, ok := ret.Get(0).(func(bool) error); ok { + r0 = returnFunc(failureState) } else { r0 = ret.Error(0) } - return r0 } @@ -624,24 +678,31 @@ func (_e *CemCEVCInterface_Expecter) SetOperatingState(failureState interface{}) func (_c *CemCEVCInterface_SetOperatingState_Call) Run(run func(failureState bool)) *CemCEVCInterface_SetOperatingState_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } -func (_c *CemCEVCInterface_SetOperatingState_Call) Return(_a0 error) *CemCEVCInterface_SetOperatingState_Call { - _c.Call.Return(_a0) +func (_c *CemCEVCInterface_SetOperatingState_Call) Return(err error) *CemCEVCInterface_SetOperatingState_Call { + _c.Call.Return(err) return _c } -func (_c *CemCEVCInterface_SetOperatingState_Call) RunAndReturn(run func(bool) error) *CemCEVCInterface_SetOperatingState_Call { +func (_c *CemCEVCInterface_SetOperatingState_Call) RunAndReturn(run func(failureState bool) error) *CemCEVCInterface_SetOperatingState_Call { _c.Call.Return(run) return _c } -// StartHeartbeat provides a mock function with no fields -func (_m *CemCEVCInterface) StartHeartbeat() { - _m.Called() +// StartHeartbeat provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) StartHeartbeat() { + _mock.Called() + return } // CemCEVCInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -671,9 +732,10 @@ func (_c *CemCEVCInterface_StartHeartbeat_Call) RunAndReturn(run func()) *CemCEV return _c } -// StopHeartbeat provides a mock function with no fields -func (_m *CemCEVCInterface) StopHeartbeat() { - _m.Called() +// StopHeartbeat provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) StopHeartbeat() { + _mock.Called() + return } // CemCEVCInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -703,31 +765,29 @@ func (_c *CemCEVCInterface_StopHeartbeat_Call) RunAndReturn(run func()) *CemCEVC return _c } -// TimeSlotConstraints provides a mock function with given fields: entity -func (_m *CemCEVCInterface) TimeSlotConstraints(entity spine_goapi.EntityRemoteInterface) (api.TimeSlotConstraints, error) { - ret := _m.Called(entity) +// TimeSlotConstraints provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) TimeSlotConstraints(entity api.EntityRemoteInterface) (api0.TimeSlotConstraints, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for TimeSlotConstraints") } - var r0 api.TimeSlotConstraints + var r0 api0.TimeSlotConstraints var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.TimeSlotConstraints, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.TimeSlotConstraints, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.TimeSlotConstraints); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.TimeSlotConstraints); ok { + r0 = returnFunc(entity) } else { - r0 = ret.Get(0).(api.TimeSlotConstraints) + r0 = ret.Get(0).(api0.TimeSlotConstraints) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -737,31 +797,38 @@ type CemCEVCInterface_TimeSlotConstraints_Call struct { } // TimeSlotConstraints is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemCEVCInterface_Expecter) TimeSlotConstraints(entity interface{}) *CemCEVCInterface_TimeSlotConstraints_Call { return &CemCEVCInterface_TimeSlotConstraints_Call{Call: _e.mock.On("TimeSlotConstraints", entity)} } -func (_c *CemCEVCInterface_TimeSlotConstraints_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemCEVCInterface_TimeSlotConstraints_Call { +func (_c *CemCEVCInterface_TimeSlotConstraints_Call) Run(run func(entity api.EntityRemoteInterface)) *CemCEVCInterface_TimeSlotConstraints_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemCEVCInterface_TimeSlotConstraints_Call) Return(_a0 api.TimeSlotConstraints, _a1 error) *CemCEVCInterface_TimeSlotConstraints_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemCEVCInterface_TimeSlotConstraints_Call) Return(timeSlotConstraints api0.TimeSlotConstraints, err error) *CemCEVCInterface_TimeSlotConstraints_Call { + _c.Call.Return(timeSlotConstraints, err) return _c } -func (_c *CemCEVCInterface_TimeSlotConstraints_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.TimeSlotConstraints, error)) *CemCEVCInterface_TimeSlotConstraints_Call { +func (_c *CemCEVCInterface_TimeSlotConstraints_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.TimeSlotConstraints, error)) *CemCEVCInterface_TimeSlotConstraints_Call { _c.Call.Return(run) return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *CemCEVCInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // CemCEVCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -777,7 +844,13 @@ func (_e *CemCEVCInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *CemCEVCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemCEVCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -787,26 +860,25 @@ func (_c *CemCEVCInterface_UpdateUseCaseAvailability_Call) Return() *CemCEVCInte return _c } -func (_c *CemCEVCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemCEVCInterface_UpdateUseCaseAvailability_Call { +func (_c *CemCEVCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemCEVCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// WriteIncentiveTableDescriptions provides a mock function with given fields: entity, data -func (_m *CemCEVCInterface) WriteIncentiveTableDescriptions(entity spine_goapi.EntityRemoteInterface, data []api.IncentiveTariffDescription) error { - ret := _m.Called(entity, data) +// WriteIncentiveTableDescriptions provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) WriteIncentiveTableDescriptions(entity api.EntityRemoteInterface, data []api0.IncentiveTariffDescription) error { + ret := _mock.Called(entity, data) if len(ret) == 0 { panic("no return value specified for WriteIncentiveTableDescriptions") } var r0 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.IncentiveTariffDescription) error); ok { - r0 = rf(entity, data) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.IncentiveTariffDescription) error); ok { + r0 = returnFunc(entity, data) } else { r0 = ret.Error(0) } - return r0 } @@ -816,44 +888,54 @@ type CemCEVCInterface_WriteIncentiveTableDescriptions_Call struct { } // WriteIncentiveTableDescriptions is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -// - data []api.IncentiveTariffDescription +// - entity api.EntityRemoteInterface +// - data []api0.IncentiveTariffDescription func (_e *CemCEVCInterface_Expecter) WriteIncentiveTableDescriptions(entity interface{}, data interface{}) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { return &CemCEVCInterface_WriteIncentiveTableDescriptions_Call{Call: _e.mock.On("WriteIncentiveTableDescriptions", entity, data)} } -func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, data []api.IncentiveTariffDescription)) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { +func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) Run(run func(entity api.EntityRemoteInterface, data []api0.IncentiveTariffDescription)) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].([]api.IncentiveTariffDescription)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 []api0.IncentiveTariffDescription + if args[1] != nil { + arg1 = args[1].([]api0.IncentiveTariffDescription) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) Return(_a0 error) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { - _c.Call.Return(_a0) +func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) Return(err error) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { + _c.Call.Return(err) return _c } -func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, []api.IncentiveTariffDescription) error) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { +func (_c *CemCEVCInterface_WriteIncentiveTableDescriptions_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, data []api0.IncentiveTariffDescription) error) *CemCEVCInterface_WriteIncentiveTableDescriptions_Call { _c.Call.Return(run) return _c } -// WriteIncentives provides a mock function with given fields: entity, data -func (_m *CemCEVCInterface) WriteIncentives(entity spine_goapi.EntityRemoteInterface, data []api.DurationSlotValue) error { - ret := _m.Called(entity, data) +// WriteIncentives provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) WriteIncentives(entity api.EntityRemoteInterface, data []api0.DurationSlotValue) error { + ret := _mock.Called(entity, data) if len(ret) == 0 { panic("no return value specified for WriteIncentives") } var r0 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.DurationSlotValue) error); ok { - r0 = rf(entity, data) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.DurationSlotValue) error); ok { + r0 = returnFunc(entity, data) } else { r0 = ret.Error(0) } - return r0 } @@ -863,44 +945,54 @@ type CemCEVCInterface_WriteIncentives_Call struct { } // WriteIncentives is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -// - data []api.DurationSlotValue +// - entity api.EntityRemoteInterface +// - data []api0.DurationSlotValue func (_e *CemCEVCInterface_Expecter) WriteIncentives(entity interface{}, data interface{}) *CemCEVCInterface_WriteIncentives_Call { return &CemCEVCInterface_WriteIncentives_Call{Call: _e.mock.On("WriteIncentives", entity, data)} } -func (_c *CemCEVCInterface_WriteIncentives_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, data []api.DurationSlotValue)) *CemCEVCInterface_WriteIncentives_Call { +func (_c *CemCEVCInterface_WriteIncentives_Call) Run(run func(entity api.EntityRemoteInterface, data []api0.DurationSlotValue)) *CemCEVCInterface_WriteIncentives_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].([]api.DurationSlotValue)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 []api0.DurationSlotValue + if args[1] != nil { + arg1 = args[1].([]api0.DurationSlotValue) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemCEVCInterface_WriteIncentives_Call) Return(_a0 error) *CemCEVCInterface_WriteIncentives_Call { - _c.Call.Return(_a0) +func (_c *CemCEVCInterface_WriteIncentives_Call) Return(err error) *CemCEVCInterface_WriteIncentives_Call { + _c.Call.Return(err) return _c } -func (_c *CemCEVCInterface_WriteIncentives_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, []api.DurationSlotValue) error) *CemCEVCInterface_WriteIncentives_Call { +func (_c *CemCEVCInterface_WriteIncentives_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, data []api0.DurationSlotValue) error) *CemCEVCInterface_WriteIncentives_Call { _c.Call.Return(run) return _c } -// WritePowerLimits provides a mock function with given fields: entity, data -func (_m *CemCEVCInterface) WritePowerLimits(entity spine_goapi.EntityRemoteInterface, data []api.DurationSlotValue) error { - ret := _m.Called(entity, data) +// WritePowerLimits provides a mock function for the type CemCEVCInterface +func (_mock *CemCEVCInterface) WritePowerLimits(entity api.EntityRemoteInterface, data []api0.DurationSlotValue) error { + ret := _mock.Called(entity, data) if len(ret) == 0 { panic("no return value specified for WritePowerLimits") } var r0 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.DurationSlotValue) error); ok { - r0 = rf(entity, data) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.DurationSlotValue) error); ok { + r0 = returnFunc(entity, data) } else { r0 = ret.Error(0) } - return r0 } @@ -910,39 +1002,36 @@ type CemCEVCInterface_WritePowerLimits_Call struct { } // WritePowerLimits is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -// - data []api.DurationSlotValue +// - entity api.EntityRemoteInterface +// - data []api0.DurationSlotValue func (_e *CemCEVCInterface_Expecter) WritePowerLimits(entity interface{}, data interface{}) *CemCEVCInterface_WritePowerLimits_Call { return &CemCEVCInterface_WritePowerLimits_Call{Call: _e.mock.On("WritePowerLimits", entity, data)} } -func (_c *CemCEVCInterface_WritePowerLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, data []api.DurationSlotValue)) *CemCEVCInterface_WritePowerLimits_Call { +func (_c *CemCEVCInterface_WritePowerLimits_Call) Run(run func(entity api.EntityRemoteInterface, data []api0.DurationSlotValue)) *CemCEVCInterface_WritePowerLimits_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].([]api.DurationSlotValue)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 []api0.DurationSlotValue + if args[1] != nil { + arg1 = args[1].([]api0.DurationSlotValue) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemCEVCInterface_WritePowerLimits_Call) Return(_a0 error) *CemCEVCInterface_WritePowerLimits_Call { - _c.Call.Return(_a0) +func (_c *CemCEVCInterface_WritePowerLimits_Call) Return(err error) *CemCEVCInterface_WritePowerLimits_Call { + _c.Call.Return(err) return _c } -func (_c *CemCEVCInterface_WritePowerLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, []api.DurationSlotValue) error) *CemCEVCInterface_WritePowerLimits_Call { +func (_c *CemCEVCInterface_WritePowerLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, data []api0.DurationSlotValue) error) *CemCEVCInterface_WritePowerLimits_Call { _c.Call.Return(run) return _c } - -// NewCemCEVCInterface creates a new instance of CemCEVCInterface. 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 NewCemCEVCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemCEVCInterface { - mock := &CemCEVCInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/CemEVCCInterface.go b/usecases/mocks/CemEVCCInterface.go index e0c845c0..a6ec3e4f 100644 --- a/usecases/mocks/CemEVCCInterface.go +++ b/usecases/mocks/CemEVCCInterface.go @@ -1,17 +1,30 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" - api "github.com/enbility/eebus-go/usecases/api" - + api1 "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" +) + +// NewCemEVCCInterface creates a new instance of CemEVCCInterface. 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 NewCemEVCCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemEVCCInterface { + mock := &CemEVCCInterface{} + mock.Mock.Test(t) - model "github.com/enbility/spine-go/model" + t.Cleanup(func() { mock.AssertExpectations(t) }) - spine_goapi "github.com/enbility/spine-go/api" -) + return mock +} // CemEVCCInterface is an autogenerated mock type for the CemEVCCInterface type type CemEVCCInterface struct { @@ -26,21 +39,20 @@ func (_m *CemEVCCInterface) EXPECT() *CemEVCCInterface_Expecter { return &CemEVCCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *CemEVCCInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -61,8 +73,8 @@ func (_c *CemEVCCInterface_AddFeatures_Call) Run(run func()) *CemEVCCInterface_A return _c } -func (_c *CemEVCCInterface_AddFeatures_Call) Return(_a0 error) *CemEVCCInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *CemEVCCInterface_AddFeatures_Call) Return(err error) *CemEVCCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -71,9 +83,10 @@ func (_c *CemEVCCInterface_AddFeatures_Call) RunAndReturn(run func() error) *Cem return _c } -// AddUseCase provides a mock function with no fields -func (_m *CemEVCCInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) AddUseCase() { + _mock.Called() + return } // CemEVCCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -103,9 +116,9 @@ func (_c *CemEVCCInterface_AddUseCase_Call) RunAndReturn(run func()) *CemEVCCInt return _c } -// AsymmetricChargingSupport provides a mock function with given fields: entity -func (_m *CemEVCCInterface) AsymmetricChargingSupport(entity spine_goapi.EntityRemoteInterface) (bool, error) { - ret := _m.Called(entity) +// AsymmetricChargingSupport provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) AsymmetricChargingSupport(entity api.EntityRemoteInterface) (bool, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AsymmetricChargingSupport") @@ -113,21 +126,19 @@ func (_m *CemEVCCInterface) AsymmetricChargingSupport(entity spine_goapi.EntityR var r0 bool var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (bool, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (bool, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -137,45 +148,50 @@ type CemEVCCInterface_AsymmetricChargingSupport_Call struct { } // AsymmetricChargingSupport is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) AsymmetricChargingSupport(entity interface{}) *CemEVCCInterface_AsymmetricChargingSupport_Call { return &CemEVCCInterface_AsymmetricChargingSupport_Call{Call: _e.mock.On("AsymmetricChargingSupport", entity)} } -func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_AsymmetricChargingSupport_Call { +func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_AsymmetricChargingSupport_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) Return(_a0 bool, _a1 error) *CemEVCCInterface_AsymmetricChargingSupport_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) Return(b bool, err error) *CemEVCCInterface_AsymmetricChargingSupport_Call { + _c.Call.Return(b, err) return _c } -func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (bool, error)) *CemEVCCInterface_AsymmetricChargingSupport_Call { +func (_c *CemEVCCInterface_AsymmetricChargingSupport_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (bool, error)) *CemEVCCInterface_AsymmetricChargingSupport_Call { _c.Call.Return(run) return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *CemEVCCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -185,53 +201,57 @@ type CemEVCCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemEVCCInterface_AvailableScenariosForEntity_Call { return &CemEVCCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemEVCCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemEVCCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemEVCCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVCCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemEVCCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// ChargeState provides a mock function with given fields: entity -func (_m *CemEVCCInterface) ChargeState(entity spine_goapi.EntityRemoteInterface) (api.EVChargeStateType, error) { - ret := _m.Called(entity) +// ChargeState provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) ChargeState(entity api.EntityRemoteInterface) (api0.EVChargeStateType, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for ChargeState") } - var r0 api.EVChargeStateType + var r0 api0.EVChargeStateType var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.EVChargeStateType, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.EVChargeStateType, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.EVChargeStateType); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.EVChargeStateType); ok { + r0 = returnFunc(entity) } else { - r0 = ret.Get(0).(api.EVChargeStateType) + r0 = ret.Get(0).(api0.EVChargeStateType) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -241,31 +261,37 @@ type CemEVCCInterface_ChargeState_Call struct { } // ChargeState is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) ChargeState(entity interface{}) *CemEVCCInterface_ChargeState_Call { return &CemEVCCInterface_ChargeState_Call{Call: _e.mock.On("ChargeState", entity)} } -func (_c *CemEVCCInterface_ChargeState_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_ChargeState_Call { +func (_c *CemEVCCInterface_ChargeState_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_ChargeState_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCCInterface_ChargeState_Call) Return(_a0 api.EVChargeStateType, _a1 error) *CemEVCCInterface_ChargeState_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVCCInterface_ChargeState_Call) Return(eVChargeStateType api0.EVChargeStateType, err error) *CemEVCCInterface_ChargeState_Call { + _c.Call.Return(eVChargeStateType, err) return _c } -func (_c *CemEVCCInterface_ChargeState_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.EVChargeStateType, error)) *CemEVCCInterface_ChargeState_Call { +func (_c *CemEVCCInterface_ChargeState_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.EVChargeStateType, error)) *CemEVCCInterface_ChargeState_Call { _c.Call.Return(run) return _c } -// ChargingPowerLimits provides a mock function with given fields: entity -func (_m *CemEVCCInterface) ChargingPowerLimits(entity spine_goapi.EntityRemoteInterface) (float64, float64, float64, error) { - ret := _m.Called(entity) +// ChargingPowerLimits provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) ChargingPowerLimits(entity api.EntityRemoteInterface) (float64, float64, float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for ChargingPowerLimits") @@ -275,33 +301,29 @@ func (_m *CemEVCCInterface) ChargingPowerLimits(entity spine_goapi.EntityRemoteI var r1 float64 var r2 float64 var r3 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, float64, float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, float64, float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) float64); ok { + r1 = returnFunc(entity) } else { r1 = ret.Get(1).(float64) } - - if rf, ok := ret.Get(2).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r2 = rf(entity) + if returnFunc, ok := ret.Get(2).(func(api.EntityRemoteInterface) float64); ok { + r2 = returnFunc(entity) } else { r2 = ret.Get(2).(float64) } - - if rf, ok := ret.Get(3).(func(spine_goapi.EntityRemoteInterface) error); ok { - r3 = rf(entity) + if returnFunc, ok := ret.Get(3).(func(api.EntityRemoteInterface) error); ok { + r3 = returnFunc(entity) } else { r3 = ret.Error(3) } - return r0, r1, r2, r3 } @@ -311,31 +333,37 @@ type CemEVCCInterface_ChargingPowerLimits_Call struct { } // ChargingPowerLimits is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) ChargingPowerLimits(entity interface{}) *CemEVCCInterface_ChargingPowerLimits_Call { return &CemEVCCInterface_ChargingPowerLimits_Call{Call: _e.mock.On("ChargingPowerLimits", entity)} } -func (_c *CemEVCCInterface_ChargingPowerLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_ChargingPowerLimits_Call { +func (_c *CemEVCCInterface_ChargingPowerLimits_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_ChargingPowerLimits_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCCInterface_ChargingPowerLimits_Call) Return(_a0 float64, _a1 float64, _a2 float64, _a3 error) *CemEVCCInterface_ChargingPowerLimits_Call { - _c.Call.Return(_a0, _a1, _a2, _a3) +func (_c *CemEVCCInterface_ChargingPowerLimits_Call) Return(f float64, f1 float64, f2 float64, err error) *CemEVCCInterface_ChargingPowerLimits_Call { + _c.Call.Return(f, f1, f2, err) return _c } -func (_c *CemEVCCInterface_ChargingPowerLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, float64, float64, error)) *CemEVCCInterface_ChargingPowerLimits_Call { +func (_c *CemEVCCInterface_ChargingPowerLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, float64, float64, error)) *CemEVCCInterface_ChargingPowerLimits_Call { _c.Call.Return(run) return _c } -// CommunicationStandard provides a mock function with given fields: entity -func (_m *CemEVCCInterface) CommunicationStandard(entity spine_goapi.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error) { - ret := _m.Called(entity) +// CommunicationStandard provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) CommunicationStandard(entity api.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for CommunicationStandard") @@ -343,21 +371,19 @@ func (_m *CemEVCCInterface) CommunicationStandard(entity spine_goapi.EntityRemot var r0 model.DeviceConfigurationKeyValueStringType var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) model.DeviceConfigurationKeyValueStringType); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) model.DeviceConfigurationKeyValueStringType); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(model.DeviceConfigurationKeyValueStringType) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -367,43 +393,48 @@ type CemEVCCInterface_CommunicationStandard_Call struct { } // CommunicationStandard is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) CommunicationStandard(entity interface{}) *CemEVCCInterface_CommunicationStandard_Call { return &CemEVCCInterface_CommunicationStandard_Call{Call: _e.mock.On("CommunicationStandard", entity)} } -func (_c *CemEVCCInterface_CommunicationStandard_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_CommunicationStandard_Call { +func (_c *CemEVCCInterface_CommunicationStandard_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_CommunicationStandard_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCCInterface_CommunicationStandard_Call) Return(_a0 model.DeviceConfigurationKeyValueStringType, _a1 error) *CemEVCCInterface_CommunicationStandard_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVCCInterface_CommunicationStandard_Call) Return(deviceConfigurationKeyValueStringType model.DeviceConfigurationKeyValueStringType, err error) *CemEVCCInterface_CommunicationStandard_Call { + _c.Call.Return(deviceConfigurationKeyValueStringType, err) return _c } -func (_c *CemEVCCInterface_CommunicationStandard_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error)) *CemEVCCInterface_CommunicationStandard_Call { +func (_c *CemEVCCInterface_CommunicationStandard_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (model.DeviceConfigurationKeyValueStringType, error)) *CemEVCCInterface_CommunicationStandard_Call { _c.Call.Return(run) return _c } -// EVConnected provides a mock function with given fields: entity -func (_m *CemEVCCInterface) EVConnected(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// EVConnected provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) EVConnected(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for EVConnected") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -413,55 +444,59 @@ type CemEVCCInterface_EVConnected_Call struct { } // EVConnected is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) EVConnected(entity interface{}) *CemEVCCInterface_EVConnected_Call { return &CemEVCCInterface_EVConnected_Call{Call: _e.mock.On("EVConnected", entity)} } -func (_c *CemEVCCInterface_EVConnected_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_EVConnected_Call { +func (_c *CemEVCCInterface_EVConnected_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_EVConnected_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCCInterface_EVConnected_Call) Return(_a0 bool) *CemEVCCInterface_EVConnected_Call { - _c.Call.Return(_a0) +func (_c *CemEVCCInterface_EVConnected_Call) Return(b bool) *CemEVCCInterface_EVConnected_Call { + _c.Call.Return(b) return _c } -func (_c *CemEVCCInterface_EVConnected_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemEVCCInterface_EVConnected_Call { +func (_c *CemEVCCInterface_EVConnected_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemEVCCInterface_EVConnected_Call { _c.Call.Return(run) return _c } -// Identifications provides a mock function with given fields: entity -func (_m *CemEVCCInterface) Identifications(entity spine_goapi.EntityRemoteInterface) ([]api.IdentificationItem, error) { - ret := _m.Called(entity) +// Identifications provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) Identifications(entity api.EntityRemoteInterface) ([]api0.IdentificationItem, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for Identifications") } - var r0 []api.IdentificationItem + var r0 []api0.IdentificationItem var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]api.IdentificationItem, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]api0.IdentificationItem, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []api.IdentificationItem); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []api0.IdentificationItem); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api.IdentificationItem) + r0 = ret.Get(0).([]api0.IdentificationItem) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -471,43 +506,48 @@ type CemEVCCInterface_Identifications_Call struct { } // Identifications is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) Identifications(entity interface{}) *CemEVCCInterface_Identifications_Call { return &CemEVCCInterface_Identifications_Call{Call: _e.mock.On("Identifications", entity)} } -func (_c *CemEVCCInterface_Identifications_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_Identifications_Call { +func (_c *CemEVCCInterface_Identifications_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_Identifications_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCCInterface_Identifications_Call) Return(_a0 []api.IdentificationItem, _a1 error) *CemEVCCInterface_Identifications_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVCCInterface_Identifications_Call) Return(identificationItems []api0.IdentificationItem, err error) *CemEVCCInterface_Identifications_Call { + _c.Call.Return(identificationItems, err) return _c } -func (_c *CemEVCCInterface_Identifications_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]api.IdentificationItem, error)) *CemEVCCInterface_Identifications_Call { +func (_c *CemEVCCInterface_Identifications_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]api0.IdentificationItem, error)) *CemEVCCInterface_Identifications_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *CemEVCCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -517,31 +557,37 @@ type CemEVCCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemEVCCInterface_IsCompatibleEntityType_Call { return &CemEVCCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemEVCCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) Return(b bool) *CemEVCCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemEVCCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVCCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemEVCCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsInSleepMode provides a mock function with given fields: entity -func (_m *CemEVCCInterface) IsInSleepMode(entity spine_goapi.EntityRemoteInterface) (bool, error) { - ret := _m.Called(entity) +// IsInSleepMode provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) IsInSleepMode(entity api.EntityRemoteInterface) (bool, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsInSleepMode") @@ -549,21 +595,19 @@ func (_m *CemEVCCInterface) IsInSleepMode(entity spine_goapi.EntityRemoteInterfa var r0 bool var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (bool, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (bool, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -573,43 +617,48 @@ type CemEVCCInterface_IsInSleepMode_Call struct { } // IsInSleepMode is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) IsInSleepMode(entity interface{}) *CemEVCCInterface_IsInSleepMode_Call { return &CemEVCCInterface_IsInSleepMode_Call{Call: _e.mock.On("IsInSleepMode", entity)} } -func (_c *CemEVCCInterface_IsInSleepMode_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_IsInSleepMode_Call { +func (_c *CemEVCCInterface_IsInSleepMode_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_IsInSleepMode_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCCInterface_IsInSleepMode_Call) Return(_a0 bool, _a1 error) *CemEVCCInterface_IsInSleepMode_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVCCInterface_IsInSleepMode_Call) Return(b bool, err error) *CemEVCCInterface_IsInSleepMode_Call { + _c.Call.Return(b, err) return _c } -func (_c *CemEVCCInterface_IsInSleepMode_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (bool, error)) *CemEVCCInterface_IsInSleepMode_Call { +func (_c *CemEVCCInterface_IsInSleepMode_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (bool, error)) *CemEVCCInterface_IsInSleepMode_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *CemEVCCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -619,54 +668,63 @@ type CemEVCCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *CemEVCCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { return &CemEVCCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVCCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemEVCCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// ManufacturerData provides a mock function with given fields: entity -func (_m *CemEVCCInterface) ManufacturerData(entity spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error) { - ret := _m.Called(entity) +// ManufacturerData provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) ManufacturerData(entity api.EntityRemoteInterface) (api0.ManufacturerData, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for ManufacturerData") } - var r0 api.ManufacturerData + var r0 api0.ManufacturerData var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.ManufacturerData, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.ManufacturerData); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.ManufacturerData); ok { + r0 = returnFunc(entity) } else { - r0 = ret.Get(0).(api.ManufacturerData) + r0 = ret.Get(0).(api0.ManufacturerData) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -676,45 +734,50 @@ type CemEVCCInterface_ManufacturerData_Call struct { } // ManufacturerData is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCCInterface_Expecter) ManufacturerData(entity interface{}) *CemEVCCInterface_ManufacturerData_Call { return &CemEVCCInterface_ManufacturerData_Call{Call: _e.mock.On("ManufacturerData", entity)} } -func (_c *CemEVCCInterface_ManufacturerData_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCCInterface_ManufacturerData_Call { +func (_c *CemEVCCInterface_ManufacturerData_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCCInterface_ManufacturerData_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCCInterface_ManufacturerData_Call) Return(_a0 api.ManufacturerData, _a1 error) *CemEVCCInterface_ManufacturerData_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVCCInterface_ManufacturerData_Call) Return(manufacturerData api0.ManufacturerData, err error) *CemEVCCInterface_ManufacturerData_Call { + _c.Call.Return(manufacturerData, err) return _c } -func (_c *CemEVCCInterface_ManufacturerData_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error)) *CemEVCCInterface_ManufacturerData_Call { +func (_c *CemEVCCInterface_ManufacturerData_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.ManufacturerData, error)) *CemEVCCInterface_ManufacturerData_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *CemEVCCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api1.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api1.RemoteEntityScenarios) } } - return r0 } @@ -735,19 +798,20 @@ func (_c *CemEVCCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemEVC return _c } -func (_c *CemEVCCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemEVCCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *CemEVCCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CemEVCCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *CemEVCCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemEVCCInterface_RemoteEntitiesScenarios_Call { +func (_c *CemEVCCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CemEVCCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *CemEVCCInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) RemoveUseCase() { + _mock.Called() + return } // CemEVCCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -777,9 +841,10 @@ func (_c *CemEVCCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemEVCC return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *CemEVCCInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type CemEVCCInterface +func (_mock *CemEVCCInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // CemEVCCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -795,7 +860,13 @@ func (_e *CemEVCCInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *CemEVCCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemEVCCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -805,21 +876,7 @@ func (_c *CemEVCCInterface_UpdateUseCaseAvailability_Call) Return() *CemEVCCInte return _c } -func (_c *CemEVCCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemEVCCInterface_UpdateUseCaseAvailability_Call { +func (_c *CemEVCCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemEVCCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } - -// NewCemEVCCInterface creates a new instance of CemEVCCInterface. 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 NewCemEVCCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemEVCCInterface { - mock := &CemEVCCInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/CemEVCEMInterface.go b/usecases/mocks/CemEVCEMInterface.go index 4876a7f3..ad688652 100644 --- a/usecases/mocks/CemEVCEMInterface.go +++ b/usecases/mocks/CemEVCEMInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/api" mock "github.com/stretchr/testify/mock" - - spine_goapi "github.com/enbility/spine-go/api" ) +// NewCemEVCEMInterface creates a new instance of CemEVCEMInterface. 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 NewCemEVCEMInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemEVCEMInterface { + mock := &CemEVCEMInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // CemEVCEMInterface is an autogenerated mock type for the CemEVCEMInterface type type CemEVCEMInterface struct { mock.Mock @@ -22,21 +37,20 @@ func (_m *CemEVCEMInterface) EXPECT() *CemEVCEMInterface_Expecter { return &CemEVCEMInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *CemEVCEMInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -57,8 +71,8 @@ func (_c *CemEVCEMInterface_AddFeatures_Call) Run(run func()) *CemEVCEMInterface return _c } -func (_c *CemEVCEMInterface_AddFeatures_Call) Return(_a0 error) *CemEVCEMInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *CemEVCEMInterface_AddFeatures_Call) Return(err error) *CemEVCEMInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -67,9 +81,10 @@ func (_c *CemEVCEMInterface_AddFeatures_Call) RunAndReturn(run func() error) *Ce return _c } -// AddUseCase provides a mock function with no fields -func (_m *CemEVCEMInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) AddUseCase() { + _mock.Called() + return } // CemEVCEMInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -99,23 +114,22 @@ func (_c *CemEVCEMInterface_AddUseCase_Call) RunAndReturn(run func()) *CemEVCEMI return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *CemEVCEMInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -125,31 +139,37 @@ type CemEVCEMInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemEVCEMInterface_AvailableScenariosForEntity_Call { return &CemEVCEMInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemEVCEMInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemEVCEMInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemEVCEMInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVCEMInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemEVCEMInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentPerPhase provides a mock function with given fields: entity -func (_m *CemEVCEMInterface) CurrentPerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { - ret := _m.Called(entity) +// CurrentPerPhase provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) CurrentPerPhase(entity api.EntityRemoteInterface) ([]float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for CurrentPerPhase") @@ -157,23 +177,21 @@ func (_m *CemEVCEMInterface) CurrentPerPhase(entity spine_goapi.EntityRemoteInte var r0 []float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -183,31 +201,37 @@ type CemEVCEMInterface_CurrentPerPhase_Call struct { } // CurrentPerPhase is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) CurrentPerPhase(entity interface{}) *CemEVCEMInterface_CurrentPerPhase_Call { return &CemEVCEMInterface_CurrentPerPhase_Call{Call: _e.mock.On("CurrentPerPhase", entity)} } -func (_c *CemEVCEMInterface_CurrentPerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_CurrentPerPhase_Call { +func (_c *CemEVCEMInterface_CurrentPerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_CurrentPerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCEMInterface_CurrentPerPhase_Call) Return(_a0 []float64, _a1 error) *CemEVCEMInterface_CurrentPerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVCEMInterface_CurrentPerPhase_Call) Return(float64s []float64, err error) *CemEVCEMInterface_CurrentPerPhase_Call { + _c.Call.Return(float64s, err) return _c } -func (_c *CemEVCEMInterface_CurrentPerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *CemEVCEMInterface_CurrentPerPhase_Call { +func (_c *CemEVCEMInterface_CurrentPerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *CemEVCEMInterface_CurrentPerPhase_Call { _c.Call.Return(run) return _c } -// EnergyCharged provides a mock function with given fields: entity -func (_m *CemEVCEMInterface) EnergyCharged(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// EnergyCharged provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) EnergyCharged(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyCharged") @@ -215,21 +239,19 @@ func (_m *CemEVCEMInterface) EnergyCharged(entity spine_goapi.EntityRemoteInterf var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -239,43 +261,48 @@ type CemEVCEMInterface_EnergyCharged_Call struct { } // EnergyCharged is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) EnergyCharged(entity interface{}) *CemEVCEMInterface_EnergyCharged_Call { return &CemEVCEMInterface_EnergyCharged_Call{Call: _e.mock.On("EnergyCharged", entity)} } -func (_c *CemEVCEMInterface_EnergyCharged_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_EnergyCharged_Call { +func (_c *CemEVCEMInterface_EnergyCharged_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_EnergyCharged_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCEMInterface_EnergyCharged_Call) Return(_a0 float64, _a1 error) *CemEVCEMInterface_EnergyCharged_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVCEMInterface_EnergyCharged_Call) Return(f float64, err error) *CemEVCEMInterface_EnergyCharged_Call { + _c.Call.Return(f, err) return _c } -func (_c *CemEVCEMInterface_EnergyCharged_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemEVCEMInterface_EnergyCharged_Call { +func (_c *CemEVCEMInterface_EnergyCharged_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemEVCEMInterface_EnergyCharged_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *CemEVCEMInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -285,43 +312,48 @@ type CemEVCEMInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemEVCEMInterface_IsCompatibleEntityType_Call { return &CemEVCEMInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_IsCompatibleEntityType_Call { +func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemEVCEMInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) Return(b bool) *CemEVCEMInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemEVCEMInterface_IsCompatibleEntityType_Call { +func (_c *CemEVCEMInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemEVCEMInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *CemEVCEMInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -331,32 +363,43 @@ type CemEVCEMInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *CemEVCEMInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { return &CemEVCEMInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemEVCEMInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// PhasesConnected provides a mock function with given fields: entity -func (_m *CemEVCEMInterface) PhasesConnected(entity spine_goapi.EntityRemoteInterface) (uint, error) { - ret := _m.Called(entity) +// PhasesConnected provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) PhasesConnected(entity api.EntityRemoteInterface) (uint, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for PhasesConnected") @@ -364,21 +407,19 @@ func (_m *CemEVCEMInterface) PhasesConnected(entity spine_goapi.EntityRemoteInte var r0 uint var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (uint, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (uint, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) uint); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(uint) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -388,31 +429,37 @@ type CemEVCEMInterface_PhasesConnected_Call struct { } // PhasesConnected is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) PhasesConnected(entity interface{}) *CemEVCEMInterface_PhasesConnected_Call { return &CemEVCEMInterface_PhasesConnected_Call{Call: _e.mock.On("PhasesConnected", entity)} } -func (_c *CemEVCEMInterface_PhasesConnected_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_PhasesConnected_Call { +func (_c *CemEVCEMInterface_PhasesConnected_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_PhasesConnected_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCEMInterface_PhasesConnected_Call) Return(_a0 uint, _a1 error) *CemEVCEMInterface_PhasesConnected_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVCEMInterface_PhasesConnected_Call) Return(v uint, err error) *CemEVCEMInterface_PhasesConnected_Call { + _c.Call.Return(v, err) return _c } -func (_c *CemEVCEMInterface_PhasesConnected_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (uint, error)) *CemEVCEMInterface_PhasesConnected_Call { +func (_c *CemEVCEMInterface_PhasesConnected_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (uint, error)) *CemEVCEMInterface_PhasesConnected_Call { _c.Call.Return(run) return _c } -// PowerPerPhase provides a mock function with given fields: entity -func (_m *CemEVCEMInterface) PowerPerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { - ret := _m.Called(entity) +// PowerPerPhase provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) PowerPerPhase(entity api.EntityRemoteInterface) ([]float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for PowerPerPhase") @@ -420,23 +467,21 @@ func (_m *CemEVCEMInterface) PowerPerPhase(entity spine_goapi.EntityRemoteInterf var r0 []float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -446,45 +491,50 @@ type CemEVCEMInterface_PowerPerPhase_Call struct { } // PowerPerPhase is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVCEMInterface_Expecter) PowerPerPhase(entity interface{}) *CemEVCEMInterface_PowerPerPhase_Call { return &CemEVCEMInterface_PowerPerPhase_Call{Call: _e.mock.On("PowerPerPhase", entity)} } -func (_c *CemEVCEMInterface_PowerPerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVCEMInterface_PowerPerPhase_Call { +func (_c *CemEVCEMInterface_PowerPerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVCEMInterface_PowerPerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVCEMInterface_PowerPerPhase_Call) Return(_a0 []float64, _a1 error) *CemEVCEMInterface_PowerPerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVCEMInterface_PowerPerPhase_Call) Return(float64s []float64, err error) *CemEVCEMInterface_PowerPerPhase_Call { + _c.Call.Return(float64s, err) return _c } -func (_c *CemEVCEMInterface_PowerPerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *CemEVCEMInterface_PowerPerPhase_Call { +func (_c *CemEVCEMInterface_PowerPerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *CemEVCEMInterface_PowerPerPhase_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *CemEVCEMInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api0.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api0.RemoteEntityScenarios) } } - return r0 } @@ -505,19 +555,20 @@ func (_c *CemEVCEMInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemEV return _c } -func (_c *CemEVCEMInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemEVCEMInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *CemEVCEMInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *CemEVCEMInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *CemEVCEMInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemEVCEMInterface_RemoteEntitiesScenarios_Call { +func (_c *CemEVCEMInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *CemEVCEMInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *CemEVCEMInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) RemoveUseCase() { + _mock.Called() + return } // CemEVCEMInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -547,9 +598,10 @@ func (_c *CemEVCEMInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemEVC return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *CemEVCEMInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type CemEVCEMInterface +func (_mock *CemEVCEMInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // CemEVCEMInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -565,7 +617,13 @@ func (_e *CemEVCEMInterface_Expecter) UpdateUseCaseAvailability(available interf func (_c *CemEVCEMInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemEVCEMInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -575,21 +633,7 @@ func (_c *CemEVCEMInterface_UpdateUseCaseAvailability_Call) Return() *CemEVCEMIn return _c } -func (_c *CemEVCEMInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemEVCEMInterface_UpdateUseCaseAvailability_Call { +func (_c *CemEVCEMInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemEVCEMInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } - -// NewCemEVCEMInterface creates a new instance of CemEVCEMInterface. 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 NewCemEVCEMInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemEVCEMInterface { - mock := &CemEVCEMInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/CemEVSECCInterface.go b/usecases/mocks/CemEVSECCInterface.go index 64d2391e..239d37be 100644 --- a/usecases/mocks/CemEVSECCInterface.go +++ b/usecases/mocks/CemEVSECCInterface.go @@ -1,17 +1,30 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" - api "github.com/enbility/eebus-go/usecases/api" - + api1 "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" +) - model "github.com/enbility/spine-go/model" +// NewCemEVSECCInterface creates a new instance of CemEVSECCInterface. 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 NewCemEVSECCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemEVSECCInterface { + mock := &CemEVSECCInterface{} + mock.Mock.Test(t) - spine_goapi "github.com/enbility/spine-go/api" -) + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} // CemEVSECCInterface is an autogenerated mock type for the CemEVSECCInterface type type CemEVSECCInterface struct { @@ -26,21 +39,20 @@ func (_m *CemEVSECCInterface) EXPECT() *CemEVSECCInterface_Expecter { return &CemEVSECCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *CemEVSECCInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type CemEVSECCInterface +func (_mock *CemEVSECCInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -61,8 +73,8 @@ func (_c *CemEVSECCInterface_AddFeatures_Call) Run(run func()) *CemEVSECCInterfa return _c } -func (_c *CemEVSECCInterface_AddFeatures_Call) Return(_a0 error) *CemEVSECCInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *CemEVSECCInterface_AddFeatures_Call) Return(err error) *CemEVSECCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -71,9 +83,10 @@ func (_c *CemEVSECCInterface_AddFeatures_Call) RunAndReturn(run func() error) *C return _c } -// AddUseCase provides a mock function with no fields -func (_m *CemEVSECCInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type CemEVSECCInterface +func (_mock *CemEVSECCInterface) AddUseCase() { + _mock.Called() + return } // CemEVSECCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -103,23 +116,22 @@ func (_c *CemEVSECCInterface_AddUseCase_Call) RunAndReturn(run func()) *CemEVSEC return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *CemEVSECCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type CemEVSECCInterface +func (_mock *CemEVSECCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -129,43 +141,48 @@ type CemEVSECCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVSECCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemEVSECCInterface_AvailableScenariosForEntity_Call { return &CemEVSECCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSECCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSECCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemEVSECCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemEVSECCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemEVSECCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVSECCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemEVSECCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *CemEVSECCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type CemEVSECCInterface +func (_mock *CemEVSECCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -175,43 +192,48 @@ type CemEVSECCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVSECCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemEVSECCInterface_IsCompatibleEntityType_Call { return &CemEVSECCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSECCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSECCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemEVSECCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) Return(b bool) *CemEVSECCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemEVSECCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVSECCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemEVSECCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *CemEVSECCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type CemEVSECCInterface +func (_mock *CemEVSECCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -221,54 +243,63 @@ type CemEVSECCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *CemEVSECCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { return &CemEVSECCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemEVSECCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// ManufacturerData provides a mock function with given fields: entity -func (_m *CemEVSECCInterface) ManufacturerData(entity spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error) { - ret := _m.Called(entity) +// ManufacturerData provides a mock function for the type CemEVSECCInterface +func (_mock *CemEVSECCInterface) ManufacturerData(entity api.EntityRemoteInterface) (api0.ManufacturerData, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for ManufacturerData") } - var r0 api.ManufacturerData + var r0 api0.ManufacturerData var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.ManufacturerData, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.ManufacturerData); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.ManufacturerData); ok { + r0 = returnFunc(entity) } else { - r0 = ret.Get(0).(api.ManufacturerData) + r0 = ret.Get(0).(api0.ManufacturerData) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -278,31 +309,37 @@ type CemEVSECCInterface_ManufacturerData_Call struct { } // ManufacturerData is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVSECCInterface_Expecter) ManufacturerData(entity interface{}) *CemEVSECCInterface_ManufacturerData_Call { return &CemEVSECCInterface_ManufacturerData_Call{Call: _e.mock.On("ManufacturerData", entity)} } -func (_c *CemEVSECCInterface_ManufacturerData_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSECCInterface_ManufacturerData_Call { +func (_c *CemEVSECCInterface_ManufacturerData_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSECCInterface_ManufacturerData_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVSECCInterface_ManufacturerData_Call) Return(_a0 api.ManufacturerData, _a1 error) *CemEVSECCInterface_ManufacturerData_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVSECCInterface_ManufacturerData_Call) Return(manufacturerData api0.ManufacturerData, err error) *CemEVSECCInterface_ManufacturerData_Call { + _c.Call.Return(manufacturerData, err) return _c } -func (_c *CemEVSECCInterface_ManufacturerData_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.ManufacturerData, error)) *CemEVSECCInterface_ManufacturerData_Call { +func (_c *CemEVSECCInterface_ManufacturerData_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.ManufacturerData, error)) *CemEVSECCInterface_ManufacturerData_Call { _c.Call.Return(run) return _c } -// OperatingState provides a mock function with given fields: entity -func (_m *CemEVSECCInterface) OperatingState(entity spine_goapi.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error) { - ret := _m.Called(entity) +// OperatingState provides a mock function for the type CemEVSECCInterface +func (_mock *CemEVSECCInterface) OperatingState(entity api.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for OperatingState") @@ -311,27 +348,24 @@ func (_m *CemEVSECCInterface) OperatingState(entity spine_goapi.EntityRemoteInte var r0 model.DeviceDiagnosisOperatingStateType var r1 string var r2 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) model.DeviceDiagnosisOperatingStateType); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) model.DeviceDiagnosisOperatingStateType); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(model.DeviceDiagnosisOperatingStateType) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) string); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) string); ok { + r1 = returnFunc(entity) } else { r1 = ret.Get(1).(string) } - - if rf, ok := ret.Get(2).(func(spine_goapi.EntityRemoteInterface) error); ok { - r2 = rf(entity) + if returnFunc, ok := ret.Get(2).(func(api.EntityRemoteInterface) error); ok { + r2 = returnFunc(entity) } else { r2 = ret.Error(2) } - return r0, r1, r2 } @@ -341,45 +375,50 @@ type CemEVSECCInterface_OperatingState_Call struct { } // OperatingState is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVSECCInterface_Expecter) OperatingState(entity interface{}) *CemEVSECCInterface_OperatingState_Call { return &CemEVSECCInterface_OperatingState_Call{Call: _e.mock.On("OperatingState", entity)} } -func (_c *CemEVSECCInterface_OperatingState_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSECCInterface_OperatingState_Call { +func (_c *CemEVSECCInterface_OperatingState_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSECCInterface_OperatingState_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVSECCInterface_OperatingState_Call) Return(_a0 model.DeviceDiagnosisOperatingStateType, _a1 string, _a2 error) *CemEVSECCInterface_OperatingState_Call { - _c.Call.Return(_a0, _a1, _a2) +func (_c *CemEVSECCInterface_OperatingState_Call) Return(deviceDiagnosisOperatingStateType model.DeviceDiagnosisOperatingStateType, s string, err error) *CemEVSECCInterface_OperatingState_Call { + _c.Call.Return(deviceDiagnosisOperatingStateType, s, err) return _c } -func (_c *CemEVSECCInterface_OperatingState_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error)) *CemEVSECCInterface_OperatingState_Call { +func (_c *CemEVSECCInterface_OperatingState_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (model.DeviceDiagnosisOperatingStateType, string, error)) *CemEVSECCInterface_OperatingState_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *CemEVSECCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type CemEVSECCInterface +func (_mock *CemEVSECCInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api1.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api1.RemoteEntityScenarios) } } - return r0 } @@ -400,19 +439,20 @@ func (_c *CemEVSECCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemE return _c } -func (_c *CemEVSECCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemEVSECCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *CemEVSECCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CemEVSECCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *CemEVSECCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemEVSECCInterface_RemoteEntitiesScenarios_Call { +func (_c *CemEVSECCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CemEVSECCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *CemEVSECCInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type CemEVSECCInterface +func (_mock *CemEVSECCInterface) RemoveUseCase() { + _mock.Called() + return } // CemEVSECCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -442,9 +482,10 @@ func (_c *CemEVSECCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemEV return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *CemEVSECCInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type CemEVSECCInterface +func (_mock *CemEVSECCInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // CemEVSECCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -460,7 +501,13 @@ func (_e *CemEVSECCInterface_Expecter) UpdateUseCaseAvailability(available inter func (_c *CemEVSECCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemEVSECCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -470,21 +517,7 @@ func (_c *CemEVSECCInterface_UpdateUseCaseAvailability_Call) Return() *CemEVSECC return _c } -func (_c *CemEVSECCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemEVSECCInterface_UpdateUseCaseAvailability_Call { +func (_c *CemEVSECCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemEVSECCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } - -// NewCemEVSECCInterface creates a new instance of CemEVSECCInterface. 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 NewCemEVSECCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemEVSECCInterface { - mock := &CemEVSECCInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/CemEVSOCInterface.go b/usecases/mocks/CemEVSOCInterface.go index 2f53810e..d3c7e0ac 100644 --- a/usecases/mocks/CemEVSOCInterface.go +++ b/usecases/mocks/CemEVSOCInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/api" mock "github.com/stretchr/testify/mock" - - spine_goapi "github.com/enbility/spine-go/api" ) +// NewCemEVSOCInterface creates a new instance of CemEVSOCInterface. 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 NewCemEVSOCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemEVSOCInterface { + mock := &CemEVSOCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // CemEVSOCInterface is an autogenerated mock type for the CemEVSOCInterface type type CemEVSOCInterface struct { mock.Mock @@ -22,21 +37,20 @@ func (_m *CemEVSOCInterface) EXPECT() *CemEVSOCInterface_Expecter { return &CemEVSOCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *CemEVSOCInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type CemEVSOCInterface +func (_mock *CemEVSOCInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -57,8 +71,8 @@ func (_c *CemEVSOCInterface_AddFeatures_Call) Run(run func()) *CemEVSOCInterface return _c } -func (_c *CemEVSOCInterface_AddFeatures_Call) Return(_a0 error) *CemEVSOCInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *CemEVSOCInterface_AddFeatures_Call) Return(err error) *CemEVSOCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -67,9 +81,10 @@ func (_c *CemEVSOCInterface_AddFeatures_Call) RunAndReturn(run func() error) *Ce return _c } -// AddUseCase provides a mock function with no fields -func (_m *CemEVSOCInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type CemEVSOCInterface +func (_mock *CemEVSOCInterface) AddUseCase() { + _mock.Called() + return } // CemEVSOCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -99,23 +114,22 @@ func (_c *CemEVSOCInterface_AddUseCase_Call) RunAndReturn(run func()) *CemEVSOCI return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *CemEVSOCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type CemEVSOCInterface +func (_mock *CemEVSOCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -125,43 +139,48 @@ type CemEVSOCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVSOCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemEVSOCInterface_AvailableScenariosForEntity_Call { return &CemEVSOCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSOCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSOCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemEVSOCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemEVSOCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemEVSOCInterface_AvailableScenariosForEntity_Call { +func (_c *CemEVSOCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemEVSOCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *CemEVSOCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type CemEVSOCInterface +func (_mock *CemEVSOCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -171,43 +190,48 @@ type CemEVSOCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVSOCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemEVSOCInterface_IsCompatibleEntityType_Call { return &CemEVSOCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSOCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSOCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemEVSOCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) Return(b bool) *CemEVSOCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemEVSOCInterface_IsCompatibleEntityType_Call { +func (_c *CemEVSOCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemEVSOCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *CemEVSOCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type CemEVSOCInterface +func (_mock *CemEVSOCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -217,46 +241,56 @@ type CemEVSOCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *CemEVSOCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { return &CemEVSOCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemEVSOCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *CemEVSOCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type CemEVSOCInterface +func (_mock *CemEVSOCInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api0.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api0.RemoteEntityScenarios) } } - return r0 } @@ -277,19 +311,20 @@ func (_c *CemEVSOCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemEV return _c } -func (_c *CemEVSOCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemEVSOCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *CemEVSOCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *CemEVSOCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *CemEVSOCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemEVSOCInterface_RemoteEntitiesScenarios_Call { +func (_c *CemEVSOCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *CemEVSOCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *CemEVSOCInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type CemEVSOCInterface +func (_mock *CemEVSOCInterface) RemoveUseCase() { + _mock.Called() + return } // CemEVSOCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -319,9 +354,9 @@ func (_c *CemEVSOCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemEVS return _c } -// StateOfCharge provides a mock function with given fields: entity -func (_m *CemEVSOCInterface) StateOfCharge(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// StateOfCharge provides a mock function for the type CemEVSOCInterface +func (_mock *CemEVSOCInterface) StateOfCharge(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for StateOfCharge") @@ -329,21 +364,19 @@ func (_m *CemEVSOCInterface) StateOfCharge(entity spine_goapi.EntityRemoteInterf var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -353,31 +386,38 @@ type CemEVSOCInterface_StateOfCharge_Call struct { } // StateOfCharge is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemEVSOCInterface_Expecter) StateOfCharge(entity interface{}) *CemEVSOCInterface_StateOfCharge_Call { return &CemEVSOCInterface_StateOfCharge_Call{Call: _e.mock.On("StateOfCharge", entity)} } -func (_c *CemEVSOCInterface_StateOfCharge_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemEVSOCInterface_StateOfCharge_Call { +func (_c *CemEVSOCInterface_StateOfCharge_Call) Run(run func(entity api.EntityRemoteInterface)) *CemEVSOCInterface_StateOfCharge_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemEVSOCInterface_StateOfCharge_Call) Return(_a0 float64, _a1 error) *CemEVSOCInterface_StateOfCharge_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemEVSOCInterface_StateOfCharge_Call) Return(f float64, err error) *CemEVSOCInterface_StateOfCharge_Call { + _c.Call.Return(f, err) return _c } -func (_c *CemEVSOCInterface_StateOfCharge_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemEVSOCInterface_StateOfCharge_Call { +func (_c *CemEVSOCInterface_StateOfCharge_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemEVSOCInterface_StateOfCharge_Call { _c.Call.Return(run) return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *CemEVSOCInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type CemEVSOCInterface +func (_mock *CemEVSOCInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // CemEVSOCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -393,7 +433,13 @@ func (_e *CemEVSOCInterface_Expecter) UpdateUseCaseAvailability(available interf func (_c *CemEVSOCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemEVSOCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -403,21 +449,7 @@ func (_c *CemEVSOCInterface_UpdateUseCaseAvailability_Call) Return() *CemEVSOCIn return _c } -func (_c *CemEVSOCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemEVSOCInterface_UpdateUseCaseAvailability_Call { +func (_c *CemEVSOCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemEVSOCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } - -// NewCemEVSOCInterface creates a new instance of CemEVSOCInterface. 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 NewCemEVSOCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemEVSOCInterface { - mock := &CemEVSOCInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/CemOPEVInterface.go b/usecases/mocks/CemOPEVInterface.go index 2040fb32..6e4ae1fd 100644 --- a/usecases/mocks/CemOPEVInterface.go +++ b/usecases/mocks/CemOPEVInterface.go @@ -1,17 +1,30 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" - api "github.com/enbility/eebus-go/usecases/api" - + api1 "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" +) - model "github.com/enbility/spine-go/model" +// NewCemOPEVInterface creates a new instance of CemOPEVInterface. 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 NewCemOPEVInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemOPEVInterface { + mock := &CemOPEVInterface{} + mock.Mock.Test(t) - spine_goapi "github.com/enbility/spine-go/api" -) + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} // CemOPEVInterface is an autogenerated mock type for the CemOPEVInterface type type CemOPEVInterface struct { @@ -26,21 +39,20 @@ func (_m *CemOPEVInterface) EXPECT() *CemOPEVInterface_Expecter { return &CemOPEVInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *CemOPEVInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -61,8 +73,8 @@ func (_c *CemOPEVInterface_AddFeatures_Call) Run(run func()) *CemOPEVInterface_A return _c } -func (_c *CemOPEVInterface_AddFeatures_Call) Return(_a0 error) *CemOPEVInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *CemOPEVInterface_AddFeatures_Call) Return(err error) *CemOPEVInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -71,9 +83,10 @@ func (_c *CemOPEVInterface_AddFeatures_Call) RunAndReturn(run func() error) *Cem return _c } -// AddUseCase provides a mock function with no fields -func (_m *CemOPEVInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) AddUseCase() { + _mock.Called() + return } // CemOPEVInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -103,23 +116,22 @@ func (_c *CemOPEVInterface_AddUseCase_Call) RunAndReturn(run func()) *CemOPEVInt return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *CemOPEVInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -129,31 +141,37 @@ type CemOPEVInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemOPEVInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemOPEVInterface_AvailableScenariosForEntity_Call { return &CemOPEVInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOPEVInterface_AvailableScenariosForEntity_Call { +func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOPEVInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemOPEVInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemOPEVInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemOPEVInterface_AvailableScenariosForEntity_Call { +func (_c *CemOPEVInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemOPEVInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentLimits provides a mock function with given fields: entity -func (_m *CemOPEVInterface) CurrentLimits(entity spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error) { - ret := _m.Called(entity) +// CurrentLimits provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) CurrentLimits(entity api.EntityRemoteInterface) ([]float64, []float64, []float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for CurrentLimits") @@ -163,39 +181,35 @@ func (_m *CemOPEVInterface) CurrentLimits(entity spine_goapi.EntityRemoteInterfa var r1 []float64 var r2 []float64 var r3 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, []float64, []float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) []float64); ok { + r1 = returnFunc(entity) } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]float64) } } - - if rf, ok := ret.Get(2).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r2 = rf(entity) + if returnFunc, ok := ret.Get(2).(func(api.EntityRemoteInterface) []float64); ok { + r2 = returnFunc(entity) } else { if ret.Get(2) != nil { r2 = ret.Get(2).([]float64) } } - - if rf, ok := ret.Get(3).(func(spine_goapi.EntityRemoteInterface) error); ok { - r3 = rf(entity) + if returnFunc, ok := ret.Get(3).(func(api.EntityRemoteInterface) error); ok { + r3 = returnFunc(entity) } else { r3 = ret.Error(3) } - return r0, r1, r2, r3 } @@ -205,43 +219,48 @@ type CemOPEVInterface_CurrentLimits_Call struct { } // CurrentLimits is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemOPEVInterface_Expecter) CurrentLimits(entity interface{}) *CemOPEVInterface_CurrentLimits_Call { return &CemOPEVInterface_CurrentLimits_Call{Call: _e.mock.On("CurrentLimits", entity)} } -func (_c *CemOPEVInterface_CurrentLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOPEVInterface_CurrentLimits_Call { +func (_c *CemOPEVInterface_CurrentLimits_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOPEVInterface_CurrentLimits_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemOPEVInterface_CurrentLimits_Call) Return(_a0 []float64, _a1 []float64, _a2 []float64, _a3 error) *CemOPEVInterface_CurrentLimits_Call { - _c.Call.Return(_a0, _a1, _a2, _a3) +func (_c *CemOPEVInterface_CurrentLimits_Call) Return(float64s []float64, float64s1 []float64, float64s2 []float64, err error) *CemOPEVInterface_CurrentLimits_Call { + _c.Call.Return(float64s, float64s1, float64s2, err) return _c } -func (_c *CemOPEVInterface_CurrentLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error)) *CemOPEVInterface_CurrentLimits_Call { +func (_c *CemOPEVInterface_CurrentLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, []float64, []float64, error)) *CemOPEVInterface_CurrentLimits_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *CemOPEVInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -251,43 +270,48 @@ type CemOPEVInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemOPEVInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemOPEVInterface_IsCompatibleEntityType_Call { return &CemOPEVInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOPEVInterface_IsCompatibleEntityType_Call { +func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOPEVInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemOPEVInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) Return(b bool) *CemOPEVInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemOPEVInterface_IsCompatibleEntityType_Call { +func (_c *CemOPEVInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemOPEVInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *CemOPEVInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -297,56 +321,65 @@ type CemOPEVInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *CemOPEVInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { return &CemOPEVInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemOPEVInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemOPEVInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// LoadControlLimits provides a mock function with given fields: entity -func (_m *CemOPEVInterface) LoadControlLimits(entity spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error) { - ret := _m.Called(entity) +// LoadControlLimits provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) LoadControlLimits(entity api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for LoadControlLimits") } - var r0 []api.LoadLimitsPhase + var r0 []api0.LoadLimitsPhase var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []api.LoadLimitsPhase); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []api0.LoadLimitsPhase); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api.LoadLimitsPhase) + r0 = ret.Get(0).([]api0.LoadLimitsPhase) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -356,45 +389,50 @@ type CemOPEVInterface_LoadControlLimits_Call struct { } // LoadControlLimits is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemOPEVInterface_Expecter) LoadControlLimits(entity interface{}) *CemOPEVInterface_LoadControlLimits_Call { return &CemOPEVInterface_LoadControlLimits_Call{Call: _e.mock.On("LoadControlLimits", entity)} } -func (_c *CemOPEVInterface_LoadControlLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOPEVInterface_LoadControlLimits_Call { +func (_c *CemOPEVInterface_LoadControlLimits_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOPEVInterface_LoadControlLimits_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemOPEVInterface_LoadControlLimits_Call) Return(limits []api.LoadLimitsPhase, resultErr error) *CemOPEVInterface_LoadControlLimits_Call { +func (_c *CemOPEVInterface_LoadControlLimits_Call) Return(limits []api0.LoadLimitsPhase, resultErr error) *CemOPEVInterface_LoadControlLimits_Call { _c.Call.Return(limits, resultErr) return _c } -func (_c *CemOPEVInterface_LoadControlLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error)) *CemOPEVInterface_LoadControlLimits_Call { +func (_c *CemOPEVInterface_LoadControlLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error)) *CemOPEVInterface_LoadControlLimits_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *CemOPEVInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api1.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api1.RemoteEntityScenarios) } } - return r0 } @@ -415,19 +453,20 @@ func (_c *CemOPEVInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemOPE return _c } -func (_c *CemOPEVInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemOPEVInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *CemOPEVInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CemOPEVInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *CemOPEVInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemOPEVInterface_RemoteEntitiesScenarios_Call { +func (_c *CemOPEVInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CemOPEVInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *CemOPEVInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) RemoveUseCase() { + _mock.Called() + return } // CemOPEVInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -457,21 +496,20 @@ func (_c *CemOPEVInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemOPEV return _c } -// SetOperatingState provides a mock function with given fields: failureState -func (_m *CemOPEVInterface) SetOperatingState(failureState bool) error { - ret := _m.Called(failureState) +// SetOperatingState provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) SetOperatingState(failureState bool) error { + ret := _mock.Called(failureState) if len(ret) == 0 { panic("no return value specified for SetOperatingState") } var r0 error - if rf, ok := ret.Get(0).(func(bool) error); ok { - r0 = rf(failureState) + if returnFunc, ok := ret.Get(0).(func(bool) error); ok { + r0 = returnFunc(failureState) } else { r0 = ret.Error(0) } - return r0 } @@ -488,24 +526,31 @@ func (_e *CemOPEVInterface_Expecter) SetOperatingState(failureState interface{}) func (_c *CemOPEVInterface_SetOperatingState_Call) Run(run func(failureState bool)) *CemOPEVInterface_SetOperatingState_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } -func (_c *CemOPEVInterface_SetOperatingState_Call) Return(_a0 error) *CemOPEVInterface_SetOperatingState_Call { - _c.Call.Return(_a0) +func (_c *CemOPEVInterface_SetOperatingState_Call) Return(err error) *CemOPEVInterface_SetOperatingState_Call { + _c.Call.Return(err) return _c } -func (_c *CemOPEVInterface_SetOperatingState_Call) RunAndReturn(run func(bool) error) *CemOPEVInterface_SetOperatingState_Call { +func (_c *CemOPEVInterface_SetOperatingState_Call) RunAndReturn(run func(failureState bool) error) *CemOPEVInterface_SetOperatingState_Call { _c.Call.Return(run) return _c } -// StartHeartbeat provides a mock function with no fields -func (_m *CemOPEVInterface) StartHeartbeat() { - _m.Called() +// StartHeartbeat provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) StartHeartbeat() { + _mock.Called() + return } // CemOPEVInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -535,9 +580,10 @@ func (_c *CemOPEVInterface_StartHeartbeat_Call) RunAndReturn(run func()) *CemOPE return _c } -// StopHeartbeat provides a mock function with no fields -func (_m *CemOPEVInterface) StopHeartbeat() { - _m.Called() +// StopHeartbeat provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) StopHeartbeat() { + _mock.Called() + return } // CemOPEVInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -567,9 +613,10 @@ func (_c *CemOPEVInterface_StopHeartbeat_Call) RunAndReturn(run func()) *CemOPEV return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *CemOPEVInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // CemOPEVInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -585,7 +632,13 @@ func (_e *CemOPEVInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *CemOPEVInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemOPEVInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -595,14 +648,14 @@ func (_c *CemOPEVInterface_UpdateUseCaseAvailability_Call) Return() *CemOPEVInte return _c } -func (_c *CemOPEVInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemOPEVInterface_UpdateUseCaseAvailability_Call { +func (_c *CemOPEVInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemOPEVInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// WriteLoadControlLimits provides a mock function with given fields: entity, limits, resultCB -func (_m *CemOPEVInterface) WriteLoadControlLimits(entity spine_goapi.EntityRemoteInterface, limits []api.LoadLimitsPhase, resultCB func(model.ResultDataType)) (*model.MsgCounterType, error) { - ret := _m.Called(entity, limits, resultCB) +// WriteLoadControlLimits provides a mock function for the type CemOPEVInterface +func (_mock *CemOPEVInterface) WriteLoadControlLimits(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error) { + ret := _mock.Called(entity, limits, resultCB) if len(ret) == 0 { panic("no return value specified for WriteLoadControlLimits") @@ -610,23 +663,21 @@ func (_m *CemOPEVInterface) WriteLoadControlLimits(entity spine_goapi.EntityRemo var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) (*model.MsgCounterType, error)); ok { - return rf(entity, limits, resultCB) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) (*model.MsgCounterType, error)); ok { + return returnFunc(entity, limits, resultCB) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) *model.MsgCounterType); ok { - r0 = rf(entity, limits, resultCB) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) *model.MsgCounterType); ok { + r0 = returnFunc(entity, limits, resultCB) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) error); ok { - r1 = rf(entity, limits, resultCB) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) error); ok { + r1 = returnFunc(entity, limits, resultCB) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -636,40 +687,42 @@ type CemOPEVInterface_WriteLoadControlLimits_Call struct { } // WriteLoadControlLimits is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -// - limits []api.LoadLimitsPhase -// - resultCB func(model.ResultDataType) +// - entity api.EntityRemoteInterface +// - limits []api0.LoadLimitsPhase +// - resultCB func(result model.ResultDataType) func (_e *CemOPEVInterface_Expecter) WriteLoadControlLimits(entity interface{}, limits interface{}, resultCB interface{}) *CemOPEVInterface_WriteLoadControlLimits_Call { return &CemOPEVInterface_WriteLoadControlLimits_Call{Call: _e.mock.On("WriteLoadControlLimits", entity, limits, resultCB)} } -func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, limits []api.LoadLimitsPhase, resultCB func(model.ResultDataType))) *CemOPEVInterface_WriteLoadControlLimits_Call { +func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) Run(run func(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType))) *CemOPEVInterface_WriteLoadControlLimits_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].([]api.LoadLimitsPhase), args[2].(func(model.ResultDataType))) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 []api0.LoadLimitsPhase + if args[1] != nil { + arg1 = args[1].([]api0.LoadLimitsPhase) + } + var arg2 func(result model.ResultDataType) + if args[2] != nil { + arg2 = args[2].(func(result model.ResultDataType)) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) Return(_a0 *model.MsgCounterType, _a1 error) *CemOPEVInterface_WriteLoadControlLimits_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) Return(msgCounterType *model.MsgCounterType, err error) *CemOPEVInterface_WriteLoadControlLimits_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) (*model.MsgCounterType, error)) *CemOPEVInterface_WriteLoadControlLimits_Call { +func (_c *CemOPEVInterface_WriteLoadControlLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error)) *CemOPEVInterface_WriteLoadControlLimits_Call { _c.Call.Return(run) return _c } - -// NewCemOPEVInterface creates a new instance of CemOPEVInterface. 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 NewCemOPEVInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemOPEVInterface { - mock := &CemOPEVInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/CemOSCEVInterface.go b/usecases/mocks/CemOSCEVInterface.go index 9e8ab8a1..15abdbd2 100644 --- a/usecases/mocks/CemOSCEVInterface.go +++ b/usecases/mocks/CemOSCEVInterface.go @@ -1,17 +1,30 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" - api "github.com/enbility/eebus-go/usecases/api" - + api1 "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" +) - model "github.com/enbility/spine-go/model" +// NewCemOSCEVInterface creates a new instance of CemOSCEVInterface. 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 NewCemOSCEVInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemOSCEVInterface { + mock := &CemOSCEVInterface{} + mock.Mock.Test(t) - spine_goapi "github.com/enbility/spine-go/api" -) + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} // CemOSCEVInterface is an autogenerated mock type for the CemOSCEVInterface type type CemOSCEVInterface struct { @@ -26,21 +39,20 @@ func (_m *CemOSCEVInterface) EXPECT() *CemOSCEVInterface_Expecter { return &CemOSCEVInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *CemOSCEVInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -61,8 +73,8 @@ func (_c *CemOSCEVInterface_AddFeatures_Call) Run(run func()) *CemOSCEVInterface return _c } -func (_c *CemOSCEVInterface_AddFeatures_Call) Return(_a0 error) *CemOSCEVInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *CemOSCEVInterface_AddFeatures_Call) Return(err error) *CemOSCEVInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -71,9 +83,10 @@ func (_c *CemOSCEVInterface_AddFeatures_Call) RunAndReturn(run func() error) *Ce return _c } -// AddUseCase provides a mock function with no fields -func (_m *CemOSCEVInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) AddUseCase() { + _mock.Called() + return } // CemOSCEVInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -103,23 +116,22 @@ func (_c *CemOSCEVInterface_AddUseCase_Call) RunAndReturn(run func()) *CemOSCEVI return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *CemOSCEVInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -129,31 +141,37 @@ type CemOSCEVInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemOSCEVInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemOSCEVInterface_AvailableScenariosForEntity_Call { return &CemOSCEVInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOSCEVInterface_AvailableScenariosForEntity_Call { +func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOSCEVInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemOSCEVInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemOSCEVInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemOSCEVInterface_AvailableScenariosForEntity_Call { +func (_c *CemOSCEVInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemOSCEVInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentLimits provides a mock function with given fields: entity -func (_m *CemOSCEVInterface) CurrentLimits(entity spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error) { - ret := _m.Called(entity) +// CurrentLimits provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) CurrentLimits(entity api.EntityRemoteInterface) ([]float64, []float64, []float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for CurrentLimits") @@ -163,39 +181,35 @@ func (_m *CemOSCEVInterface) CurrentLimits(entity spine_goapi.EntityRemoteInterf var r1 []float64 var r2 []float64 var r3 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, []float64, []float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) []float64); ok { + r1 = returnFunc(entity) } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]float64) } } - - if rf, ok := ret.Get(2).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r2 = rf(entity) + if returnFunc, ok := ret.Get(2).(func(api.EntityRemoteInterface) []float64); ok { + r2 = returnFunc(entity) } else { if ret.Get(2) != nil { r2 = ret.Get(2).([]float64) } } - - if rf, ok := ret.Get(3).(func(spine_goapi.EntityRemoteInterface) error); ok { - r3 = rf(entity) + if returnFunc, ok := ret.Get(3).(func(api.EntityRemoteInterface) error); ok { + r3 = returnFunc(entity) } else { r3 = ret.Error(3) } - return r0, r1, r2, r3 } @@ -205,43 +219,48 @@ type CemOSCEVInterface_CurrentLimits_Call struct { } // CurrentLimits is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemOSCEVInterface_Expecter) CurrentLimits(entity interface{}) *CemOSCEVInterface_CurrentLimits_Call { return &CemOSCEVInterface_CurrentLimits_Call{Call: _e.mock.On("CurrentLimits", entity)} } -func (_c *CemOSCEVInterface_CurrentLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOSCEVInterface_CurrentLimits_Call { +func (_c *CemOSCEVInterface_CurrentLimits_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOSCEVInterface_CurrentLimits_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemOSCEVInterface_CurrentLimits_Call) Return(_a0 []float64, _a1 []float64, _a2 []float64, _a3 error) *CemOSCEVInterface_CurrentLimits_Call { - _c.Call.Return(_a0, _a1, _a2, _a3) +func (_c *CemOSCEVInterface_CurrentLimits_Call) Return(float64s []float64, float64s1 []float64, float64s2 []float64, err error) *CemOSCEVInterface_CurrentLimits_Call { + _c.Call.Return(float64s, float64s1, float64s2, err) return _c } -func (_c *CemOSCEVInterface_CurrentLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, []float64, []float64, error)) *CemOSCEVInterface_CurrentLimits_Call { +func (_c *CemOSCEVInterface_CurrentLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, []float64, []float64, error)) *CemOSCEVInterface_CurrentLimits_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *CemOSCEVInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -251,43 +270,48 @@ type CemOSCEVInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemOSCEVInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemOSCEVInterface_IsCompatibleEntityType_Call { return &CemOSCEVInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOSCEVInterface_IsCompatibleEntityType_Call { +func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOSCEVInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemOSCEVInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) Return(b bool) *CemOSCEVInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemOSCEVInterface_IsCompatibleEntityType_Call { +func (_c *CemOSCEVInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemOSCEVInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *CemOSCEVInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -297,56 +321,65 @@ type CemOSCEVInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *CemOSCEVInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { return &CemOSCEVInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemOSCEVInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// LoadControlLimits provides a mock function with given fields: entity -func (_m *CemOSCEVInterface) LoadControlLimits(entity spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error) { - ret := _m.Called(entity) +// LoadControlLimits provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) LoadControlLimits(entity api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for LoadControlLimits") } - var r0 []api.LoadLimitsPhase + var r0 []api0.LoadLimitsPhase var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []api.LoadLimitsPhase); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []api0.LoadLimitsPhase); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]api.LoadLimitsPhase) + r0 = ret.Get(0).([]api0.LoadLimitsPhase) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -356,45 +389,50 @@ type CemOSCEVInterface_LoadControlLimits_Call struct { } // LoadControlLimits is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemOSCEVInterface_Expecter) LoadControlLimits(entity interface{}) *CemOSCEVInterface_LoadControlLimits_Call { return &CemOSCEVInterface_LoadControlLimits_Call{Call: _e.mock.On("LoadControlLimits", entity)} } -func (_c *CemOSCEVInterface_LoadControlLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemOSCEVInterface_LoadControlLimits_Call { +func (_c *CemOSCEVInterface_LoadControlLimits_Call) Run(run func(entity api.EntityRemoteInterface)) *CemOSCEVInterface_LoadControlLimits_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemOSCEVInterface_LoadControlLimits_Call) Return(limits []api.LoadLimitsPhase, resultErr error) *CemOSCEVInterface_LoadControlLimits_Call { +func (_c *CemOSCEVInterface_LoadControlLimits_Call) Return(limits []api0.LoadLimitsPhase, resultErr error) *CemOSCEVInterface_LoadControlLimits_Call { _c.Call.Return(limits, resultErr) return _c } -func (_c *CemOSCEVInterface_LoadControlLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]api.LoadLimitsPhase, error)) *CemOSCEVInterface_LoadControlLimits_Call { +func (_c *CemOSCEVInterface_LoadControlLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]api0.LoadLimitsPhase, error)) *CemOSCEVInterface_LoadControlLimits_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *CemOSCEVInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api1.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api1.RemoteEntityScenarios) } } - return r0 } @@ -415,19 +453,20 @@ func (_c *CemOSCEVInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemOS return _c } -func (_c *CemOSCEVInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemOSCEVInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *CemOSCEVInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CemOSCEVInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *CemOSCEVInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemOSCEVInterface_RemoteEntitiesScenarios_Call { +func (_c *CemOSCEVInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CemOSCEVInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *CemOSCEVInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) RemoveUseCase() { + _mock.Called() + return } // CemOSCEVInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -457,21 +496,20 @@ func (_c *CemOSCEVInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemOSC return _c } -// SetOperatingState provides a mock function with given fields: failureState -func (_m *CemOSCEVInterface) SetOperatingState(failureState bool) error { - ret := _m.Called(failureState) +// SetOperatingState provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) SetOperatingState(failureState bool) error { + ret := _mock.Called(failureState) if len(ret) == 0 { panic("no return value specified for SetOperatingState") } var r0 error - if rf, ok := ret.Get(0).(func(bool) error); ok { - r0 = rf(failureState) + if returnFunc, ok := ret.Get(0).(func(bool) error); ok { + r0 = returnFunc(failureState) } else { r0 = ret.Error(0) } - return r0 } @@ -488,24 +526,31 @@ func (_e *CemOSCEVInterface_Expecter) SetOperatingState(failureState interface{} func (_c *CemOSCEVInterface_SetOperatingState_Call) Run(run func(failureState bool)) *CemOSCEVInterface_SetOperatingState_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } -func (_c *CemOSCEVInterface_SetOperatingState_Call) Return(_a0 error) *CemOSCEVInterface_SetOperatingState_Call { - _c.Call.Return(_a0) +func (_c *CemOSCEVInterface_SetOperatingState_Call) Return(err error) *CemOSCEVInterface_SetOperatingState_Call { + _c.Call.Return(err) return _c } -func (_c *CemOSCEVInterface_SetOperatingState_Call) RunAndReturn(run func(bool) error) *CemOSCEVInterface_SetOperatingState_Call { +func (_c *CemOSCEVInterface_SetOperatingState_Call) RunAndReturn(run func(failureState bool) error) *CemOSCEVInterface_SetOperatingState_Call { _c.Call.Return(run) return _c } -// StartHeartbeat provides a mock function with no fields -func (_m *CemOSCEVInterface) StartHeartbeat() { - _m.Called() +// StartHeartbeat provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) StartHeartbeat() { + _mock.Called() + return } // CemOSCEVInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -535,9 +580,10 @@ func (_c *CemOSCEVInterface_StartHeartbeat_Call) RunAndReturn(run func()) *CemOS return _c } -// StopHeartbeat provides a mock function with no fields -func (_m *CemOSCEVInterface) StopHeartbeat() { - _m.Called() +// StopHeartbeat provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) StopHeartbeat() { + _mock.Called() + return } // CemOSCEVInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -567,9 +613,10 @@ func (_c *CemOSCEVInterface_StopHeartbeat_Call) RunAndReturn(run func()) *CemOSC return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *CemOSCEVInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // CemOSCEVInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -585,7 +632,13 @@ func (_e *CemOSCEVInterface_Expecter) UpdateUseCaseAvailability(available interf func (_c *CemOSCEVInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemOSCEVInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -595,14 +648,14 @@ func (_c *CemOSCEVInterface_UpdateUseCaseAvailability_Call) Return() *CemOSCEVIn return _c } -func (_c *CemOSCEVInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemOSCEVInterface_UpdateUseCaseAvailability_Call { +func (_c *CemOSCEVInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemOSCEVInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// WriteLoadControlLimits provides a mock function with given fields: entity, limits, resultCB -func (_m *CemOSCEVInterface) WriteLoadControlLimits(entity spine_goapi.EntityRemoteInterface, limits []api.LoadLimitsPhase, resultCB func(model.ResultDataType)) (*model.MsgCounterType, error) { - ret := _m.Called(entity, limits, resultCB) +// WriteLoadControlLimits provides a mock function for the type CemOSCEVInterface +func (_mock *CemOSCEVInterface) WriteLoadControlLimits(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error) { + ret := _mock.Called(entity, limits, resultCB) if len(ret) == 0 { panic("no return value specified for WriteLoadControlLimits") @@ -610,23 +663,21 @@ func (_m *CemOSCEVInterface) WriteLoadControlLimits(entity spine_goapi.EntityRem var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) (*model.MsgCounterType, error)); ok { - return rf(entity, limits, resultCB) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) (*model.MsgCounterType, error)); ok { + return returnFunc(entity, limits, resultCB) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) *model.MsgCounterType); ok { - r0 = rf(entity, limits, resultCB) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) *model.MsgCounterType); ok { + r0 = returnFunc(entity, limits, resultCB) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) error); ok { - r1 = rf(entity, limits, resultCB) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, []api0.LoadLimitsPhase, func(result model.ResultDataType)) error); ok { + r1 = returnFunc(entity, limits, resultCB) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -636,40 +687,42 @@ type CemOSCEVInterface_WriteLoadControlLimits_Call struct { } // WriteLoadControlLimits is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -// - limits []api.LoadLimitsPhase -// - resultCB func(model.ResultDataType) +// - entity api.EntityRemoteInterface +// - limits []api0.LoadLimitsPhase +// - resultCB func(result model.ResultDataType) func (_e *CemOSCEVInterface_Expecter) WriteLoadControlLimits(entity interface{}, limits interface{}, resultCB interface{}) *CemOSCEVInterface_WriteLoadControlLimits_Call { return &CemOSCEVInterface_WriteLoadControlLimits_Call{Call: _e.mock.On("WriteLoadControlLimits", entity, limits, resultCB)} } -func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, limits []api.LoadLimitsPhase, resultCB func(model.ResultDataType))) *CemOSCEVInterface_WriteLoadControlLimits_Call { +func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) Run(run func(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType))) *CemOSCEVInterface_WriteLoadControlLimits_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].([]api.LoadLimitsPhase), args[2].(func(model.ResultDataType))) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 []api0.LoadLimitsPhase + if args[1] != nil { + arg1 = args[1].([]api0.LoadLimitsPhase) + } + var arg2 func(result model.ResultDataType) + if args[2] != nil { + arg2 = args[2].(func(result model.ResultDataType)) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) Return(_a0 *model.MsgCounterType, _a1 error) *CemOSCEVInterface_WriteLoadControlLimits_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) Return(msgCounterType *model.MsgCounterType, err error) *CemOSCEVInterface_WriteLoadControlLimits_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, []api.LoadLimitsPhase, func(model.ResultDataType)) (*model.MsgCounterType, error)) *CemOSCEVInterface_WriteLoadControlLimits_Call { +func (_c *CemOSCEVInterface_WriteLoadControlLimits_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, limits []api0.LoadLimitsPhase, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error)) *CemOSCEVInterface_WriteLoadControlLimits_Call { _c.Call.Return(run) return _c } - -// NewCemOSCEVInterface creates a new instance of CemOSCEVInterface. 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 NewCemOSCEVInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemOSCEVInterface { - mock := &CemOSCEVInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/CemVABDInterface.go b/usecases/mocks/CemVABDInterface.go index 5f55973c..0d14200a 100644 --- a/usecases/mocks/CemVABDInterface.go +++ b/usecases/mocks/CemVABDInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/api" mock "github.com/stretchr/testify/mock" - - spine_goapi "github.com/enbility/spine-go/api" ) +// NewCemVABDInterface creates a new instance of CemVABDInterface. 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 NewCemVABDInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemVABDInterface { + mock := &CemVABDInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // CemVABDInterface is an autogenerated mock type for the CemVABDInterface type type CemVABDInterface struct { mock.Mock @@ -22,21 +37,20 @@ func (_m *CemVABDInterface) EXPECT() *CemVABDInterface_Expecter { return &CemVABDInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *CemVABDInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -57,8 +71,8 @@ func (_c *CemVABDInterface_AddFeatures_Call) Run(run func()) *CemVABDInterface_A return _c } -func (_c *CemVABDInterface_AddFeatures_Call) Return(_a0 error) *CemVABDInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *CemVABDInterface_AddFeatures_Call) Return(err error) *CemVABDInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -67,9 +81,10 @@ func (_c *CemVABDInterface_AddFeatures_Call) RunAndReturn(run func() error) *Cem return _c } -// AddUseCase provides a mock function with no fields -func (_m *CemVABDInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) AddUseCase() { + _mock.Called() + return } // CemVABDInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -99,23 +114,22 @@ func (_c *CemVABDInterface_AddUseCase_Call) RunAndReturn(run func()) *CemVABDInt return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *CemVABDInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -125,31 +139,37 @@ type CemVABDInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemVABDInterface_AvailableScenariosForEntity_Call { return &CemVABDInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_AvailableScenariosForEntity_Call { +func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemVABDInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemVABDInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemVABDInterface_AvailableScenariosForEntity_Call { +func (_c *CemVABDInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemVABDInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// EnergyCharged provides a mock function with given fields: entity -func (_m *CemVABDInterface) EnergyCharged(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// EnergyCharged provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) EnergyCharged(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyCharged") @@ -157,21 +177,19 @@ func (_m *CemVABDInterface) EnergyCharged(entity spine_goapi.EntityRemoteInterfa var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -181,31 +199,37 @@ type CemVABDInterface_EnergyCharged_Call struct { } // EnergyCharged is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) EnergyCharged(entity interface{}) *CemVABDInterface_EnergyCharged_Call { return &CemVABDInterface_EnergyCharged_Call{Call: _e.mock.On("EnergyCharged", entity)} } -func (_c *CemVABDInterface_EnergyCharged_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_EnergyCharged_Call { +func (_c *CemVABDInterface_EnergyCharged_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_EnergyCharged_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemVABDInterface_EnergyCharged_Call) Return(_a0 float64, _a1 error) *CemVABDInterface_EnergyCharged_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemVABDInterface_EnergyCharged_Call) Return(f float64, err error) *CemVABDInterface_EnergyCharged_Call { + _c.Call.Return(f, err) return _c } -func (_c *CemVABDInterface_EnergyCharged_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVABDInterface_EnergyCharged_Call { +func (_c *CemVABDInterface_EnergyCharged_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVABDInterface_EnergyCharged_Call { _c.Call.Return(run) return _c } -// EnergyDischarged provides a mock function with given fields: entity -func (_m *CemVABDInterface) EnergyDischarged(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// EnergyDischarged provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) EnergyDischarged(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyDischarged") @@ -213,21 +237,19 @@ func (_m *CemVABDInterface) EnergyDischarged(entity spine_goapi.EntityRemoteInte var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -237,43 +259,48 @@ type CemVABDInterface_EnergyDischarged_Call struct { } // EnergyDischarged is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) EnergyDischarged(entity interface{}) *CemVABDInterface_EnergyDischarged_Call { return &CemVABDInterface_EnergyDischarged_Call{Call: _e.mock.On("EnergyDischarged", entity)} } -func (_c *CemVABDInterface_EnergyDischarged_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_EnergyDischarged_Call { +func (_c *CemVABDInterface_EnergyDischarged_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_EnergyDischarged_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemVABDInterface_EnergyDischarged_Call) Return(_a0 float64, _a1 error) *CemVABDInterface_EnergyDischarged_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemVABDInterface_EnergyDischarged_Call) Return(f float64, err error) *CemVABDInterface_EnergyDischarged_Call { + _c.Call.Return(f, err) return _c } -func (_c *CemVABDInterface_EnergyDischarged_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVABDInterface_EnergyDischarged_Call { +func (_c *CemVABDInterface_EnergyDischarged_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVABDInterface_EnergyDischarged_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *CemVABDInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -283,43 +310,48 @@ type CemVABDInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemVABDInterface_IsCompatibleEntityType_Call { return &CemVABDInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemVABDInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_IsCompatibleEntityType_Call { +func (_c *CemVABDInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemVABDInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemVABDInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *CemVABDInterface_IsCompatibleEntityType_Call) Return(b bool) *CemVABDInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *CemVABDInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemVABDInterface_IsCompatibleEntityType_Call { +func (_c *CemVABDInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemVABDInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *CemVABDInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -329,32 +361,43 @@ type CemVABDInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *CemVABDInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { return &CemVABDInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemVABDInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemVABDInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// Power provides a mock function with given fields: entity -func (_m *CemVABDInterface) Power(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// Power provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) Power(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for Power") @@ -362,21 +405,19 @@ func (_m *CemVABDInterface) Power(entity spine_goapi.EntityRemoteInterface) (flo var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -386,45 +427,50 @@ type CemVABDInterface_Power_Call struct { } // Power is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) Power(entity interface{}) *CemVABDInterface_Power_Call { return &CemVABDInterface_Power_Call{Call: _e.mock.On("Power", entity)} } -func (_c *CemVABDInterface_Power_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_Power_Call { +func (_c *CemVABDInterface_Power_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_Power_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemVABDInterface_Power_Call) Return(_a0 float64, _a1 error) *CemVABDInterface_Power_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemVABDInterface_Power_Call) Return(f float64, err error) *CemVABDInterface_Power_Call { + _c.Call.Return(f, err) return _c } -func (_c *CemVABDInterface_Power_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVABDInterface_Power_Call { +func (_c *CemVABDInterface_Power_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVABDInterface_Power_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *CemVABDInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api0.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api0.RemoteEntityScenarios) } } - return r0 } @@ -445,19 +491,20 @@ func (_c *CemVABDInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemVAB return _c } -func (_c *CemVABDInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemVABDInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *CemVABDInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *CemVABDInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *CemVABDInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemVABDInterface_RemoteEntitiesScenarios_Call { +func (_c *CemVABDInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *CemVABDInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *CemVABDInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) RemoveUseCase() { + _mock.Called() + return } // CemVABDInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -487,9 +534,9 @@ func (_c *CemVABDInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemVABD return _c } -// StateOfCharge provides a mock function with given fields: entity -func (_m *CemVABDInterface) StateOfCharge(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// StateOfCharge provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) StateOfCharge(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for StateOfCharge") @@ -497,21 +544,19 @@ func (_m *CemVABDInterface) StateOfCharge(entity spine_goapi.EntityRemoteInterfa var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -521,31 +566,38 @@ type CemVABDInterface_StateOfCharge_Call struct { } // StateOfCharge is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemVABDInterface_Expecter) StateOfCharge(entity interface{}) *CemVABDInterface_StateOfCharge_Call { return &CemVABDInterface_StateOfCharge_Call{Call: _e.mock.On("StateOfCharge", entity)} } -func (_c *CemVABDInterface_StateOfCharge_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVABDInterface_StateOfCharge_Call { +func (_c *CemVABDInterface_StateOfCharge_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVABDInterface_StateOfCharge_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemVABDInterface_StateOfCharge_Call) Return(_a0 float64, _a1 error) *CemVABDInterface_StateOfCharge_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemVABDInterface_StateOfCharge_Call) Return(f float64, err error) *CemVABDInterface_StateOfCharge_Call { + _c.Call.Return(f, err) return _c } -func (_c *CemVABDInterface_StateOfCharge_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVABDInterface_StateOfCharge_Call { +func (_c *CemVABDInterface_StateOfCharge_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVABDInterface_StateOfCharge_Call { _c.Call.Return(run) return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *CemVABDInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type CemVABDInterface +func (_mock *CemVABDInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // CemVABDInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -561,7 +613,13 @@ func (_e *CemVABDInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *CemVABDInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemVABDInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -571,21 +629,7 @@ func (_c *CemVABDInterface_UpdateUseCaseAvailability_Call) Return() *CemVABDInte return _c } -func (_c *CemVABDInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemVABDInterface_UpdateUseCaseAvailability_Call { +func (_c *CemVABDInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemVABDInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } - -// NewCemVABDInterface creates a new instance of CemVABDInterface. 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 NewCemVABDInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemVABDInterface { - mock := &CemVABDInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/CemVAPDInterface.go b/usecases/mocks/CemVAPDInterface.go index 2bac0b59..a9b2d65d 100644 --- a/usecases/mocks/CemVAPDInterface.go +++ b/usecases/mocks/CemVAPDInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/api" mock "github.com/stretchr/testify/mock" - - spine_goapi "github.com/enbility/spine-go/api" ) +// NewCemVAPDInterface creates a new instance of CemVAPDInterface. 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 NewCemVAPDInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CemVAPDInterface { + mock := &CemVAPDInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // CemVAPDInterface is an autogenerated mock type for the CemVAPDInterface type type CemVAPDInterface struct { mock.Mock @@ -22,21 +37,20 @@ func (_m *CemVAPDInterface) EXPECT() *CemVAPDInterface_Expecter { return &CemVAPDInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *CemVAPDInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type CemVAPDInterface +func (_mock *CemVAPDInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -57,8 +71,8 @@ func (_c *CemVAPDInterface_AddFeatures_Call) Run(run func()) *CemVAPDInterface_A return _c } -func (_c *CemVAPDInterface_AddFeatures_Call) Return(_a0 error) *CemVAPDInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *CemVAPDInterface_AddFeatures_Call) Return(err error) *CemVAPDInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -67,9 +81,10 @@ func (_c *CemVAPDInterface_AddFeatures_Call) RunAndReturn(run func() error) *Cem return _c } -// AddUseCase provides a mock function with no fields -func (_m *CemVAPDInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type CemVAPDInterface +func (_mock *CemVAPDInterface) AddUseCase() { + _mock.Called() + return } // CemVAPDInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -99,23 +114,22 @@ func (_c *CemVAPDInterface_AddUseCase_Call) RunAndReturn(run func()) *CemVAPDInt return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *CemVAPDInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type CemVAPDInterface +func (_mock *CemVAPDInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -125,43 +139,48 @@ type CemVAPDInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemVAPDInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CemVAPDInterface_AvailableScenariosForEntity_Call { return &CemVAPDInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVAPDInterface_AvailableScenariosForEntity_Call { +func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVAPDInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CemVAPDInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CemVAPDInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CemVAPDInterface_AvailableScenariosForEntity_Call { +func (_c *CemVAPDInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CemVAPDInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *CemVAPDInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type CemVAPDInterface +func (_mock *CemVAPDInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -171,43 +190,48 @@ type CemVAPDInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemVAPDInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CemVAPDInterface_IsCompatibleEntityType_Call { return &CemVAPDInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVAPDInterface_IsCompatibleEntityType_Call { +func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVAPDInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CemVAPDInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) Return(b bool) *CemVAPDInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CemVAPDInterface_IsCompatibleEntityType_Call { +func (_c *CemVAPDInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CemVAPDInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *CemVAPDInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type CemVAPDInterface +func (_mock *CemVAPDInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -217,32 +241,43 @@ type CemVAPDInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *CemVAPDInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { return &CemVAPDInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CemVAPDInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CemVAPDInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// PVYieldTotal provides a mock function with given fields: entity -func (_m *CemVAPDInterface) PVYieldTotal(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// PVYieldTotal provides a mock function for the type CemVAPDInterface +func (_mock *CemVAPDInterface) PVYieldTotal(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for PVYieldTotal") @@ -250,21 +285,19 @@ func (_m *CemVAPDInterface) PVYieldTotal(entity spine_goapi.EntityRemoteInterfac var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -274,31 +307,37 @@ type CemVAPDInterface_PVYieldTotal_Call struct { } // PVYieldTotal is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemVAPDInterface_Expecter) PVYieldTotal(entity interface{}) *CemVAPDInterface_PVYieldTotal_Call { return &CemVAPDInterface_PVYieldTotal_Call{Call: _e.mock.On("PVYieldTotal", entity)} } -func (_c *CemVAPDInterface_PVYieldTotal_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVAPDInterface_PVYieldTotal_Call { +func (_c *CemVAPDInterface_PVYieldTotal_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVAPDInterface_PVYieldTotal_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemVAPDInterface_PVYieldTotal_Call) Return(_a0 float64, _a1 error) *CemVAPDInterface_PVYieldTotal_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemVAPDInterface_PVYieldTotal_Call) Return(f float64, err error) *CemVAPDInterface_PVYieldTotal_Call { + _c.Call.Return(f, err) return _c } -func (_c *CemVAPDInterface_PVYieldTotal_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_PVYieldTotal_Call { +func (_c *CemVAPDInterface_PVYieldTotal_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_PVYieldTotal_Call { _c.Call.Return(run) return _c } -// Power provides a mock function with given fields: entity -func (_m *CemVAPDInterface) Power(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// Power provides a mock function for the type CemVAPDInterface +func (_mock *CemVAPDInterface) Power(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for Power") @@ -306,21 +345,19 @@ func (_m *CemVAPDInterface) Power(entity spine_goapi.EntityRemoteInterface) (flo var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -330,31 +367,37 @@ type CemVAPDInterface_Power_Call struct { } // Power is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemVAPDInterface_Expecter) Power(entity interface{}) *CemVAPDInterface_Power_Call { return &CemVAPDInterface_Power_Call{Call: _e.mock.On("Power", entity)} } -func (_c *CemVAPDInterface_Power_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVAPDInterface_Power_Call { +func (_c *CemVAPDInterface_Power_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVAPDInterface_Power_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemVAPDInterface_Power_Call) Return(_a0 float64, _a1 error) *CemVAPDInterface_Power_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemVAPDInterface_Power_Call) Return(f float64, err error) *CemVAPDInterface_Power_Call { + _c.Call.Return(f, err) return _c } -func (_c *CemVAPDInterface_Power_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_Power_Call { +func (_c *CemVAPDInterface_Power_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_Power_Call { _c.Call.Return(run) return _c } -// PowerNominalPeak provides a mock function with given fields: entity -func (_m *CemVAPDInterface) PowerNominalPeak(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// PowerNominalPeak provides a mock function for the type CemVAPDInterface +func (_mock *CemVAPDInterface) PowerNominalPeak(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for PowerNominalPeak") @@ -362,21 +405,19 @@ func (_m *CemVAPDInterface) PowerNominalPeak(entity spine_goapi.EntityRemoteInte var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -386,45 +427,50 @@ type CemVAPDInterface_PowerNominalPeak_Call struct { } // PowerNominalPeak is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CemVAPDInterface_Expecter) PowerNominalPeak(entity interface{}) *CemVAPDInterface_PowerNominalPeak_Call { return &CemVAPDInterface_PowerNominalPeak_Call{Call: _e.mock.On("PowerNominalPeak", entity)} } -func (_c *CemVAPDInterface_PowerNominalPeak_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CemVAPDInterface_PowerNominalPeak_Call { +func (_c *CemVAPDInterface_PowerNominalPeak_Call) Run(run func(entity api.EntityRemoteInterface)) *CemVAPDInterface_PowerNominalPeak_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CemVAPDInterface_PowerNominalPeak_Call) Return(_a0 float64, _a1 error) *CemVAPDInterface_PowerNominalPeak_Call { - _c.Call.Return(_a0, _a1) +func (_c *CemVAPDInterface_PowerNominalPeak_Call) Return(f float64, err error) *CemVAPDInterface_PowerNominalPeak_Call { + _c.Call.Return(f, err) return _c } -func (_c *CemVAPDInterface_PowerNominalPeak_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_PowerNominalPeak_Call { +func (_c *CemVAPDInterface_PowerNominalPeak_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *CemVAPDInterface_PowerNominalPeak_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *CemVAPDInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type CemVAPDInterface +func (_mock *CemVAPDInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api0.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api0.RemoteEntityScenarios) } } - return r0 } @@ -445,19 +491,20 @@ func (_c *CemVAPDInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CemVAP return _c } -func (_c *CemVAPDInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CemVAPDInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *CemVAPDInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *CemVAPDInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *CemVAPDInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CemVAPDInterface_RemoteEntitiesScenarios_Call { +func (_c *CemVAPDInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *CemVAPDInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *CemVAPDInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type CemVAPDInterface +func (_mock *CemVAPDInterface) RemoveUseCase() { + _mock.Called() + return } // CemVAPDInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -487,9 +534,10 @@ func (_c *CemVAPDInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CemVAPD return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *CemVAPDInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type CemVAPDInterface +func (_mock *CemVAPDInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // CemVAPDInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -505,7 +553,13 @@ func (_e *CemVAPDInterface_Expecter) UpdateUseCaseAvailability(available interfa func (_c *CemVAPDInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CemVAPDInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -515,21 +569,7 @@ func (_c *CemVAPDInterface_UpdateUseCaseAvailability_Call) Return() *CemVAPDInte return _c } -func (_c *CemVAPDInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CemVAPDInterface_UpdateUseCaseAvailability_Call { +func (_c *CemVAPDInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CemVAPDInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } - -// NewCemVAPDInterface creates a new instance of CemVAPDInterface. 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 NewCemVAPDInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CemVAPDInterface { - mock := &CemVAPDInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/CsLPCInterface.go b/usecases/mocks/CsLPCInterface.go index 0da91277..a4785973 100644 --- a/usecases/mocks/CsLPCInterface.go +++ b/usecases/mocks/CsLPCInterface.go @@ -1,19 +1,32 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" - api "github.com/enbility/eebus-go/usecases/api" + "time" + api1 "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" +) - model "github.com/enbility/spine-go/model" +// NewCsLPCInterface creates a new instance of CsLPCInterface. 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 NewCsLPCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CsLPCInterface { + mock := &CsLPCInterface{} + mock.Mock.Test(t) - spine_goapi "github.com/enbility/spine-go/api" + t.Cleanup(func() { mock.AssertExpectations(t) }) - time "time" -) + return mock +} // CsLPCInterface is an autogenerated mock type for the CsLPCInterface type type CsLPCInterface struct { @@ -28,21 +41,20 @@ func (_m *CsLPCInterface) EXPECT() *CsLPCInterface_Expecter { return &CsLPCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *CsLPCInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -63,8 +75,8 @@ func (_c *CsLPCInterface_AddFeatures_Call) Run(run func()) *CsLPCInterface_AddFe return _c } -func (_c *CsLPCInterface_AddFeatures_Call) Return(_a0 error) *CsLPCInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *CsLPCInterface_AddFeatures_Call) Return(err error) *CsLPCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -73,9 +85,10 @@ func (_c *CsLPCInterface_AddFeatures_Call) RunAndReturn(run func() error) *CsLPC return _c } -// AddUseCase provides a mock function with no fields -func (_m *CsLPCInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) AddUseCase() { + _mock.Called() + return } // CsLPCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -105,9 +118,10 @@ func (_c *CsLPCInterface_AddUseCase_Call) RunAndReturn(run func()) *CsLPCInterfa return _c } -// ApproveOrDenyConsumptionLimit provides a mock function with given fields: msgCounter, approve, reason -func (_m *CsLPCInterface) ApproveOrDenyConsumptionLimit(msgCounter model.MsgCounterType, approve bool, reason string) { - _m.Called(msgCounter, approve, reason) +// ApproveOrDenyConsumptionLimit provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) ApproveOrDenyConsumptionLimit(msgCounter model.MsgCounterType, approve bool, reason string) { + _mock.Called(msgCounter, approve, reason) + return } // CsLPCInterface_ApproveOrDenyConsumptionLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApproveOrDenyConsumptionLimit' @@ -125,7 +139,23 @@ func (_e *CsLPCInterface_Expecter) ApproveOrDenyConsumptionLimit(msgCounter inte func (_c *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call) Run(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.MsgCounterType), args[1].(bool), args[2].(string)) + var arg0 model.MsgCounterType + if args[0] != nil { + arg0 = args[0].(model.MsgCounterType) + } + var arg1 bool + if args[1] != nil { + arg1 = args[1].(bool) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } @@ -135,28 +165,79 @@ func (_c *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call) Return() *CsLPCInte return _c } -func (_c *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call) RunAndReturn(run func(model.MsgCounterType, bool, string)) *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call { +func (_c *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call) RunAndReturn(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPCInterface_ApproveOrDenyConsumptionLimit_Call { _c.Run(run) return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *CsLPCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// ApproveOrDenyDeviceConfiguration provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) ApproveOrDenyDeviceConfiguration(msgCounter model.MsgCounterType, approve bool, reason string) { + _mock.Called(msgCounter, approve, reason) + return +} + +// CsLPCInterface_ApproveOrDenyDeviceConfiguration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApproveOrDenyDeviceConfiguration' +type CsLPCInterface_ApproveOrDenyDeviceConfiguration_Call struct { + *mock.Call +} + +// ApproveOrDenyDeviceConfiguration is a helper method to define mock.On call +// - msgCounter model.MsgCounterType +// - approve bool +// - reason string +func (_e *CsLPCInterface_Expecter) ApproveOrDenyDeviceConfiguration(msgCounter interface{}, approve interface{}, reason interface{}) *CsLPCInterface_ApproveOrDenyDeviceConfiguration_Call { + return &CsLPCInterface_ApproveOrDenyDeviceConfiguration_Call{Call: _e.mock.On("ApproveOrDenyDeviceConfiguration", msgCounter, approve, reason)} +} + +func (_c *CsLPCInterface_ApproveOrDenyDeviceConfiguration_Call) Run(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPCInterface_ApproveOrDenyDeviceConfiguration_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 model.MsgCounterType + if args[0] != nil { + arg0 = args[0].(model.MsgCounterType) + } + var arg1 bool + if args[1] != nil { + arg1 = args[1].(bool) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *CsLPCInterface_ApproveOrDenyDeviceConfiguration_Call) Return() *CsLPCInterface_ApproveOrDenyDeviceConfiguration_Call { + _c.Call.Return() + return _c +} + +func (_c *CsLPCInterface_ApproveOrDenyDeviceConfiguration_Call) RunAndReturn(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPCInterface_ApproveOrDenyDeviceConfiguration_Call { + _c.Run(run) + return _c +} + +// AvailableScenariosForEntity provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -166,53 +247,57 @@ type CsLPCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CsLPCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CsLPCInterface_AvailableScenariosForEntity_Call { return &CsLPCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CsLPCInterface_AvailableScenariosForEntity_Call { +func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CsLPCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CsLPCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CsLPCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CsLPCInterface_AvailableScenariosForEntity_Call { +func (_c *CsLPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CsLPCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// ConsumptionLimit provides a mock function with no fields -func (_m *CsLPCInterface) ConsumptionLimit() (api.LoadLimit, error) { - ret := _m.Called() +// ConsumptionLimit provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) ConsumptionLimit() (api0.LoadLimit, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for ConsumptionLimit") } - var r0 api.LoadLimit + var r0 api0.LoadLimit var r1 error - if rf, ok := ret.Get(0).(func() (api.LoadLimit, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (api0.LoadLimit, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() api.LoadLimit); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() api0.LoadLimit); ok { + r0 = returnFunc() } else { - r0 = ret.Get(0).(api.LoadLimit) + r0 = ret.Get(0).(api0.LoadLimit) } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -233,19 +318,19 @@ func (_c *CsLPCInterface_ConsumptionLimit_Call) Run(run func()) *CsLPCInterface_ return _c } -func (_c *CsLPCInterface_ConsumptionLimit_Call) Return(_a0 api.LoadLimit, _a1 error) *CsLPCInterface_ConsumptionLimit_Call { - _c.Call.Return(_a0, _a1) +func (_c *CsLPCInterface_ConsumptionLimit_Call) Return(loadLimit api0.LoadLimit, err error) *CsLPCInterface_ConsumptionLimit_Call { + _c.Call.Return(loadLimit, err) return _c } -func (_c *CsLPCInterface_ConsumptionLimit_Call) RunAndReturn(run func() (api.LoadLimit, error)) *CsLPCInterface_ConsumptionLimit_Call { +func (_c *CsLPCInterface_ConsumptionLimit_Call) RunAndReturn(run func() (api0.LoadLimit, error)) *CsLPCInterface_ConsumptionLimit_Call { _c.Call.Return(run) return _c } -// ConsumptionNominalMax provides a mock function with no fields -func (_m *CsLPCInterface) ConsumptionNominalMax() (float64, error) { - ret := _m.Called() +// ConsumptionNominalMax provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) ConsumptionNominalMax() (float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for ConsumptionNominalMax") @@ -253,21 +338,19 @@ func (_m *CsLPCInterface) ConsumptionNominalMax() (float64, error) { var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func() (float64, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() float64); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -288,8 +371,8 @@ func (_c *CsLPCInterface_ConsumptionNominalMax_Call) Run(run func()) *CsLPCInter return _c } -func (_c *CsLPCInterface_ConsumptionNominalMax_Call) Return(_a0 float64, _a1 error) *CsLPCInterface_ConsumptionNominalMax_Call { - _c.Call.Return(_a0, _a1) +func (_c *CsLPCInterface_ConsumptionNominalMax_Call) Return(f float64, err error) *CsLPCInterface_ConsumptionNominalMax_Call { + _c.Call.Return(f, err) return _c } @@ -298,9 +381,9 @@ func (_c *CsLPCInterface_ConsumptionNominalMax_Call) RunAndReturn(run func() (fl return _c } -// FailsafeConsumptionActivePowerLimit provides a mock function with no fields -func (_m *CsLPCInterface) FailsafeConsumptionActivePowerLimit() (float64, bool, error) { - ret := _m.Called() +// FailsafeConsumptionActivePowerLimit provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) FailsafeConsumptionActivePowerLimit() (float64, bool, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for FailsafeConsumptionActivePowerLimit") @@ -309,27 +392,24 @@ func (_m *CsLPCInterface) FailsafeConsumptionActivePowerLimit() (float64, bool, var r0 float64 var r1 bool var r2 error - if rf, ok := ret.Get(0).(func() (float64, bool, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (float64, bool, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() float64); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func() bool); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() bool); ok { + r1 = returnFunc() } else { r1 = ret.Get(1).(bool) } - - if rf, ok := ret.Get(2).(func() error); ok { - r2 = rf() + if returnFunc, ok := ret.Get(2).(func() error); ok { + r2 = returnFunc() } else { r2 = ret.Error(2) } - return r0, r1, r2 } @@ -360,9 +440,9 @@ func (_c *CsLPCInterface_FailsafeConsumptionActivePowerLimit_Call) RunAndReturn( return _c } -// FailsafeDurationMinimum provides a mock function with no fields -func (_m *CsLPCInterface) FailsafeDurationMinimum() (time.Duration, bool, error) { - ret := _m.Called() +// FailsafeDurationMinimum provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) FailsafeDurationMinimum() (time.Duration, bool, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for FailsafeDurationMinimum") @@ -371,27 +451,24 @@ func (_m *CsLPCInterface) FailsafeDurationMinimum() (time.Duration, bool, error) var r0 time.Duration var r1 bool var r2 error - if rf, ok := ret.Get(0).(func() (time.Duration, bool, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (time.Duration, bool, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() time.Duration); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() time.Duration); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(time.Duration) } - - if rf, ok := ret.Get(1).(func() bool); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() bool); ok { + r1 = returnFunc() } else { r1 = ret.Get(1).(bool) } - - if rf, ok := ret.Get(2).(func() error); ok { - r2 = rf() + if returnFunc, ok := ret.Get(2).(func() error); ok { + r2 = returnFunc() } else { r2 = ret.Error(2) } - return r0, r1, r2 } @@ -422,21 +499,20 @@ func (_c *CsLPCInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func() ( return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *CsLPCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -446,43 +522,48 @@ type CsLPCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CsLPCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CsLPCInterface_IsCompatibleEntityType_Call { return &CsLPCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CsLPCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CsLPCInterface_IsCompatibleEntityType_Call { +func (_c *CsLPCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CsLPCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CsLPCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CsLPCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *CsLPCInterface_IsCompatibleEntityType_Call) Return(b bool) *CsLPCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *CsLPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CsLPCInterface_IsCompatibleEntityType_Call { +func (_c *CsLPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CsLPCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsHeartbeatWithinDuration provides a mock function with no fields -func (_m *CsLPCInterface) IsHeartbeatWithinDuration() bool { - ret := _m.Called() +// IsHeartbeatWithinDuration provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) IsHeartbeatWithinDuration() bool { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for IsHeartbeatWithinDuration") } var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -503,8 +584,8 @@ func (_c *CsLPCInterface_IsHeartbeatWithinDuration_Call) Run(run func()) *CsLPCI return _c } -func (_c *CsLPCInterface_IsHeartbeatWithinDuration_Call) Return(_a0 bool) *CsLPCInterface_IsHeartbeatWithinDuration_Call { - _c.Call.Return(_a0) +func (_c *CsLPCInterface_IsHeartbeatWithinDuration_Call) Return(b bool) *CsLPCInterface_IsHeartbeatWithinDuration_Call { + _c.Call.Return(b) return _c } @@ -513,21 +594,20 @@ func (_c *CsLPCInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func() return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *CsLPCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -537,46 +617,56 @@ type CsLPCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *CsLPCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { return &CsLPCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CsLPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CsLPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// PendingConsumptionLimits provides a mock function with no fields -func (_m *CsLPCInterface) PendingConsumptionLimits() map[model.MsgCounterType]api.LoadLimit { - ret := _m.Called() +// PendingConsumptionLimits provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) PendingConsumptionLimits() map[model.MsgCounterType]api0.LoadLimit { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for PendingConsumptionLimits") } - var r0 map[model.MsgCounterType]api.LoadLimit - if rf, ok := ret.Get(0).(func() map[model.MsgCounterType]api.LoadLimit); ok { - r0 = rf() + var r0 map[model.MsgCounterType]api0.LoadLimit + if returnFunc, ok := ret.Get(0).(func() map[model.MsgCounterType]api0.LoadLimit); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[model.MsgCounterType]api.LoadLimit) + r0 = ret.Get(0).(map[model.MsgCounterType]api0.LoadLimit) } } - return r0 } @@ -597,33 +687,78 @@ func (_c *CsLPCInterface_PendingConsumptionLimits_Call) Run(run func()) *CsLPCIn return _c } -func (_c *CsLPCInterface_PendingConsumptionLimits_Call) Return(_a0 map[model.MsgCounterType]api.LoadLimit) *CsLPCInterface_PendingConsumptionLimits_Call { - _c.Call.Return(_a0) +func (_c *CsLPCInterface_PendingConsumptionLimits_Call) Return(msgCounterTypeToLoadLimit map[model.MsgCounterType]api0.LoadLimit) *CsLPCInterface_PendingConsumptionLimits_Call { + _c.Call.Return(msgCounterTypeToLoadLimit) return _c } -func (_c *CsLPCInterface_PendingConsumptionLimits_Call) RunAndReturn(run func() map[model.MsgCounterType]api.LoadLimit) *CsLPCInterface_PendingConsumptionLimits_Call { +func (_c *CsLPCInterface_PendingConsumptionLimits_Call) RunAndReturn(run func() map[model.MsgCounterType]api0.LoadLimit) *CsLPCInterface_PendingConsumptionLimits_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *CsLPCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// PendingDeviceConfigurations provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) PendingDeviceConfigurations() map[model.MsgCounterType][]api0.PendingDeviceConfiguration { + ret := _mock.Called() if len(ret) == 0 { - panic("no return value specified for RemoteEntitiesScenarios") + panic("no return value specified for PendingDeviceConfigurations") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 map[model.MsgCounterType][]api0.PendingDeviceConfiguration + if returnFunc, ok := ret.Get(0).(func() map[model.MsgCounterType][]api0.PendingDeviceConfiguration); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).(map[model.MsgCounterType][]api0.PendingDeviceConfiguration) } } + return r0 +} + +// CsLPCInterface_PendingDeviceConfigurations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PendingDeviceConfigurations' +type CsLPCInterface_PendingDeviceConfigurations_Call struct { + *mock.Call +} + +// PendingDeviceConfigurations is a helper method to define mock.On call +func (_e *CsLPCInterface_Expecter) PendingDeviceConfigurations() *CsLPCInterface_PendingDeviceConfigurations_Call { + return &CsLPCInterface_PendingDeviceConfigurations_Call{Call: _e.mock.On("PendingDeviceConfigurations")} +} + +func (_c *CsLPCInterface_PendingDeviceConfigurations_Call) Run(run func()) *CsLPCInterface_PendingDeviceConfigurations_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *CsLPCInterface_PendingDeviceConfigurations_Call) Return(msgCounterTypeToPendingDeviceConfigurations map[model.MsgCounterType][]api0.PendingDeviceConfiguration) *CsLPCInterface_PendingDeviceConfigurations_Call { + _c.Call.Return(msgCounterTypeToPendingDeviceConfigurations) + return _c +} + +func (_c *CsLPCInterface_PendingDeviceConfigurations_Call) RunAndReturn(run func() map[model.MsgCounterType][]api0.PendingDeviceConfiguration) *CsLPCInterface_PendingDeviceConfigurations_Call { + _c.Call.Return(run) + return _c +} + +// RemoteEntitiesScenarios provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for RemoteEntitiesScenarios") + } + var r0 []api1.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]api1.RemoteEntityScenarios) + } + } return r0 } @@ -644,19 +779,20 @@ func (_c *CsLPCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CsLPCInt return _c } -func (_c *CsLPCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CsLPCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *CsLPCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CsLPCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *CsLPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CsLPCInterface_RemoteEntitiesScenarios_Call { +func (_c *CsLPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CsLPCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *CsLPCInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) RemoveUseCase() { + _mock.Called() + return } // CsLPCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -686,21 +822,20 @@ func (_c *CsLPCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CsLPCInte return _c } -// SetConsumptionLimit provides a mock function with given fields: limit -func (_m *CsLPCInterface) SetConsumptionLimit(limit api.LoadLimit) error { - ret := _m.Called(limit) +// SetConsumptionLimit provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) SetConsumptionLimit(limit api0.LoadLimit) error { + ret := _mock.Called(limit) if len(ret) == 0 { panic("no return value specified for SetConsumptionLimit") } var r0 error - if rf, ok := ret.Get(0).(func(api.LoadLimit) error); ok { - r0 = rf(limit) + if returnFunc, ok := ret.Get(0).(func(api0.LoadLimit) error); ok { + r0 = returnFunc(limit) } else { r0 = ret.Error(0) } - return r0 } @@ -710,14 +845,20 @@ type CsLPCInterface_SetConsumptionLimit_Call struct { } // SetConsumptionLimit is a helper method to define mock.On call -// - limit api.LoadLimit +// - limit api0.LoadLimit func (_e *CsLPCInterface_Expecter) SetConsumptionLimit(limit interface{}) *CsLPCInterface_SetConsumptionLimit_Call { return &CsLPCInterface_SetConsumptionLimit_Call{Call: _e.mock.On("SetConsumptionLimit", limit)} } -func (_c *CsLPCInterface_SetConsumptionLimit_Call) Run(run func(limit api.LoadLimit)) *CsLPCInterface_SetConsumptionLimit_Call { +func (_c *CsLPCInterface_SetConsumptionLimit_Call) Run(run func(limit api0.LoadLimit)) *CsLPCInterface_SetConsumptionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(api.LoadLimit)) + var arg0 api0.LoadLimit + if args[0] != nil { + arg0 = args[0].(api0.LoadLimit) + } + run( + arg0, + ) }) return _c } @@ -727,26 +868,25 @@ func (_c *CsLPCInterface_SetConsumptionLimit_Call) Return(resultErr error) *CsLP return _c } -func (_c *CsLPCInterface_SetConsumptionLimit_Call) RunAndReturn(run func(api.LoadLimit) error) *CsLPCInterface_SetConsumptionLimit_Call { +func (_c *CsLPCInterface_SetConsumptionLimit_Call) RunAndReturn(run func(limit api0.LoadLimit) error) *CsLPCInterface_SetConsumptionLimit_Call { _c.Call.Return(run) return _c } -// SetConsumptionNominalMax provides a mock function with given fields: value -func (_m *CsLPCInterface) SetConsumptionNominalMax(value float64) error { - ret := _m.Called(value) +// SetConsumptionNominalMax provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) SetConsumptionNominalMax(value float64) error { + ret := _mock.Called(value) if len(ret) == 0 { panic("no return value specified for SetConsumptionNominalMax") } var r0 error - if rf, ok := ret.Get(0).(func(float64) error); ok { - r0 = rf(value) + if returnFunc, ok := ret.Get(0).(func(float64) error); ok { + r0 = returnFunc(value) } else { r0 = ret.Error(0) } - return r0 } @@ -763,7 +903,13 @@ func (_e *CsLPCInterface_Expecter) SetConsumptionNominalMax(value interface{}) * func (_c *CsLPCInterface_SetConsumptionNominalMax_Call) Run(run func(value float64)) *CsLPCInterface_SetConsumptionNominalMax_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + run( + arg0, + ) }) return _c } @@ -773,26 +919,25 @@ func (_c *CsLPCInterface_SetConsumptionNominalMax_Call) Return(resultErr error) return _c } -func (_c *CsLPCInterface_SetConsumptionNominalMax_Call) RunAndReturn(run func(float64) error) *CsLPCInterface_SetConsumptionNominalMax_Call { +func (_c *CsLPCInterface_SetConsumptionNominalMax_Call) RunAndReturn(run func(value float64) error) *CsLPCInterface_SetConsumptionNominalMax_Call { _c.Call.Return(run) return _c } -// SetFailsafeConsumptionActivePowerLimit provides a mock function with given fields: value, changeable -func (_m *CsLPCInterface) SetFailsafeConsumptionActivePowerLimit(value float64, changeable bool) error { - ret := _m.Called(value, changeable) +// SetFailsafeConsumptionActivePowerLimit provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) SetFailsafeConsumptionActivePowerLimit(value float64, changeable bool) error { + ret := _mock.Called(value, changeable) if len(ret) == 0 { panic("no return value specified for SetFailsafeConsumptionActivePowerLimit") } var r0 error - if rf, ok := ret.Get(0).(func(float64, bool) error); ok { - r0 = rf(value, changeable) + if returnFunc, ok := ret.Get(0).(func(float64, bool) error); ok { + r0 = returnFunc(value, changeable) } else { r0 = ret.Error(0) } - return r0 } @@ -810,7 +955,18 @@ func (_e *CsLPCInterface_Expecter) SetFailsafeConsumptionActivePowerLimit(value func (_c *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call) Run(run func(value float64, changeable bool)) *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(bool)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 bool + if args[1] != nil { + arg1 = args[1].(bool) + } + run( + arg0, + arg1, + ) }) return _c } @@ -820,26 +976,25 @@ func (_c *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call) Return(res return _c } -func (_c *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(float64, bool) error) *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call { +func (_c *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(value float64, changeable bool) error) *CsLPCInterface_SetFailsafeConsumptionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// SetFailsafeDurationMinimum provides a mock function with given fields: duration, changeable -func (_m *CsLPCInterface) SetFailsafeDurationMinimum(duration time.Duration, changeable bool) error { - ret := _m.Called(duration, changeable) +// SetFailsafeDurationMinimum provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) SetFailsafeDurationMinimum(duration time.Duration, changeable bool) error { + ret := _mock.Called(duration, changeable) if len(ret) == 0 { panic("no return value specified for SetFailsafeDurationMinimum") } var r0 error - if rf, ok := ret.Get(0).(func(time.Duration, bool) error); ok { - r0 = rf(duration, changeable) + if returnFunc, ok := ret.Get(0).(func(time.Duration, bool) error); ok { + r0 = returnFunc(duration, changeable) } else { r0 = ret.Error(0) } - return r0 } @@ -857,7 +1012,18 @@ func (_e *CsLPCInterface_Expecter) SetFailsafeDurationMinimum(duration interface func (_c *CsLPCInterface_SetFailsafeDurationMinimum_Call) Run(run func(duration time.Duration, changeable bool)) *CsLPCInterface_SetFailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(time.Duration), args[1].(bool)) + var arg0 time.Duration + if args[0] != nil { + arg0 = args[0].(time.Duration) + } + var arg1 bool + if args[1] != nil { + arg1 = args[1].(bool) + } + run( + arg0, + arg1, + ) }) return _c } @@ -867,14 +1033,15 @@ func (_c *CsLPCInterface_SetFailsafeDurationMinimum_Call) Return(resultErr error return _c } -func (_c *CsLPCInterface_SetFailsafeDurationMinimum_Call) RunAndReturn(run func(time.Duration, bool) error) *CsLPCInterface_SetFailsafeDurationMinimum_Call { +func (_c *CsLPCInterface_SetFailsafeDurationMinimum_Call) RunAndReturn(run func(duration time.Duration, changeable bool) error) *CsLPCInterface_SetFailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } -// StartHeartbeat provides a mock function with no fields -func (_m *CsLPCInterface) StartHeartbeat() { - _m.Called() +// StartHeartbeat provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) StartHeartbeat() { + _mock.Called() + return } // CsLPCInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -904,9 +1071,10 @@ func (_c *CsLPCInterface_StartHeartbeat_Call) RunAndReturn(run func()) *CsLPCInt return _c } -// StopHeartbeat provides a mock function with no fields -func (_m *CsLPCInterface) StopHeartbeat() { - _m.Called() +// StopHeartbeat provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) StopHeartbeat() { + _mock.Called() + return } // CsLPCInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -936,9 +1104,10 @@ func (_c *CsLPCInterface_StopHeartbeat_Call) RunAndReturn(run func()) *CsLPCInte return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *CsLPCInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type CsLPCInterface +func (_mock *CsLPCInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // CsLPCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -954,7 +1123,13 @@ func (_e *CsLPCInterface_Expecter) UpdateUseCaseAvailability(available interface func (_c *CsLPCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CsLPCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -964,21 +1139,7 @@ func (_c *CsLPCInterface_UpdateUseCaseAvailability_Call) Return() *CsLPCInterfac return _c } -func (_c *CsLPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CsLPCInterface_UpdateUseCaseAvailability_Call { +func (_c *CsLPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CsLPCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } - -// NewCsLPCInterface creates a new instance of CsLPCInterface. 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 NewCsLPCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CsLPCInterface { - mock := &CsLPCInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/CsLPPInterface.go b/usecases/mocks/CsLPPInterface.go index ebb81b1b..8ef2f6cc 100644 --- a/usecases/mocks/CsLPPInterface.go +++ b/usecases/mocks/CsLPPInterface.go @@ -1,19 +1,32 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" - api "github.com/enbility/eebus-go/usecases/api" + "time" + api1 "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" +) - model "github.com/enbility/spine-go/model" +// NewCsLPPInterface creates a new instance of CsLPPInterface. 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 NewCsLPPInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *CsLPPInterface { + mock := &CsLPPInterface{} + mock.Mock.Test(t) - spine_goapi "github.com/enbility/spine-go/api" + t.Cleanup(func() { mock.AssertExpectations(t) }) - time "time" -) + return mock +} // CsLPPInterface is an autogenerated mock type for the CsLPPInterface type type CsLPPInterface struct { @@ -28,21 +41,20 @@ func (_m *CsLPPInterface) EXPECT() *CsLPPInterface_Expecter { return &CsLPPInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *CsLPPInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -63,8 +75,8 @@ func (_c *CsLPPInterface_AddFeatures_Call) Run(run func()) *CsLPPInterface_AddFe return _c } -func (_c *CsLPPInterface_AddFeatures_Call) Return(_a0 error) *CsLPPInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *CsLPPInterface_AddFeatures_Call) Return(err error) *CsLPPInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -73,9 +85,10 @@ func (_c *CsLPPInterface_AddFeatures_Call) RunAndReturn(run func() error) *CsLPP return _c } -// AddUseCase provides a mock function with no fields -func (_m *CsLPPInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) AddUseCase() { + _mock.Called() + return } // CsLPPInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -105,9 +118,62 @@ func (_c *CsLPPInterface_AddUseCase_Call) RunAndReturn(run func()) *CsLPPInterfa return _c } -// ApproveOrDenyProductionLimit provides a mock function with given fields: msgCounter, approve, reason -func (_m *CsLPPInterface) ApproveOrDenyProductionLimit(msgCounter model.MsgCounterType, approve bool, reason string) { - _m.Called(msgCounter, approve, reason) +// ApproveOrDenyDeviceConfiguration provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) ApproveOrDenyDeviceConfiguration(msgCounter model.MsgCounterType, approve bool, reason string) { + _mock.Called(msgCounter, approve, reason) + return +} + +// CsLPPInterface_ApproveOrDenyDeviceConfiguration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApproveOrDenyDeviceConfiguration' +type CsLPPInterface_ApproveOrDenyDeviceConfiguration_Call struct { + *mock.Call +} + +// ApproveOrDenyDeviceConfiguration is a helper method to define mock.On call +// - msgCounter model.MsgCounterType +// - approve bool +// - reason string +func (_e *CsLPPInterface_Expecter) ApproveOrDenyDeviceConfiguration(msgCounter interface{}, approve interface{}, reason interface{}) *CsLPPInterface_ApproveOrDenyDeviceConfiguration_Call { + return &CsLPPInterface_ApproveOrDenyDeviceConfiguration_Call{Call: _e.mock.On("ApproveOrDenyDeviceConfiguration", msgCounter, approve, reason)} +} + +func (_c *CsLPPInterface_ApproveOrDenyDeviceConfiguration_Call) Run(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPPInterface_ApproveOrDenyDeviceConfiguration_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 model.MsgCounterType + if args[0] != nil { + arg0 = args[0].(model.MsgCounterType) + } + var arg1 bool + if args[1] != nil { + arg1 = args[1].(bool) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *CsLPPInterface_ApproveOrDenyDeviceConfiguration_Call) Return() *CsLPPInterface_ApproveOrDenyDeviceConfiguration_Call { + _c.Call.Return() + return _c +} + +func (_c *CsLPPInterface_ApproveOrDenyDeviceConfiguration_Call) RunAndReturn(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPPInterface_ApproveOrDenyDeviceConfiguration_Call { + _c.Run(run) + return _c +} + +// ApproveOrDenyProductionLimit provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) ApproveOrDenyProductionLimit(msgCounter model.MsgCounterType, approve bool, reason string) { + _mock.Called(msgCounter, approve, reason) + return } // CsLPPInterface_ApproveOrDenyProductionLimit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApproveOrDenyProductionLimit' @@ -125,7 +191,23 @@ func (_e *CsLPPInterface_Expecter) ApproveOrDenyProductionLimit(msgCounter inter func (_c *CsLPPInterface_ApproveOrDenyProductionLimit_Call) Run(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPPInterface_ApproveOrDenyProductionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(model.MsgCounterType), args[1].(bool), args[2].(string)) + var arg0 model.MsgCounterType + if args[0] != nil { + arg0 = args[0].(model.MsgCounterType) + } + var arg1 bool + if args[1] != nil { + arg1 = args[1].(bool) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } @@ -135,28 +217,27 @@ func (_c *CsLPPInterface_ApproveOrDenyProductionLimit_Call) Return() *CsLPPInter return _c } -func (_c *CsLPPInterface_ApproveOrDenyProductionLimit_Call) RunAndReturn(run func(model.MsgCounterType, bool, string)) *CsLPPInterface_ApproveOrDenyProductionLimit_Call { +func (_c *CsLPPInterface_ApproveOrDenyProductionLimit_Call) RunAndReturn(run func(msgCounter model.MsgCounterType, approve bool, reason string)) *CsLPPInterface_ApproveOrDenyProductionLimit_Call { _c.Run(run) return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *CsLPPInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -166,31 +247,37 @@ type CsLPPInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CsLPPInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *CsLPPInterface_AvailableScenariosForEntity_Call { return &CsLPPInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CsLPPInterface_AvailableScenariosForEntity_Call { +func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *CsLPPInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *CsLPPInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *CsLPPInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *CsLPPInterface_AvailableScenariosForEntity_Call { +func (_c *CsLPPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *CsLPPInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// FailsafeDurationMinimum provides a mock function with no fields -func (_m *CsLPPInterface) FailsafeDurationMinimum() (time.Duration, bool, error) { - ret := _m.Called() +// FailsafeDurationMinimum provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) FailsafeDurationMinimum() (time.Duration, bool, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for FailsafeDurationMinimum") @@ -199,27 +286,24 @@ func (_m *CsLPPInterface) FailsafeDurationMinimum() (time.Duration, bool, error) var r0 time.Duration var r1 bool var r2 error - if rf, ok := ret.Get(0).(func() (time.Duration, bool, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (time.Duration, bool, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() time.Duration); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() time.Duration); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(time.Duration) } - - if rf, ok := ret.Get(1).(func() bool); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() bool); ok { + r1 = returnFunc() } else { r1 = ret.Get(1).(bool) } - - if rf, ok := ret.Get(2).(func() error); ok { - r2 = rf() + if returnFunc, ok := ret.Get(2).(func() error); ok { + r2 = returnFunc() } else { r2 = ret.Error(2) } - return r0, r1, r2 } @@ -250,9 +334,9 @@ func (_c *CsLPPInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func() ( return _c } -// FailsafeProductionActivePowerLimit provides a mock function with no fields -func (_m *CsLPPInterface) FailsafeProductionActivePowerLimit() (float64, bool, error) { - ret := _m.Called() +// FailsafeProductionActivePowerLimit provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) FailsafeProductionActivePowerLimit() (float64, bool, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for FailsafeProductionActivePowerLimit") @@ -261,27 +345,24 @@ func (_m *CsLPPInterface) FailsafeProductionActivePowerLimit() (float64, bool, e var r0 float64 var r1 bool var r2 error - if rf, ok := ret.Get(0).(func() (float64, bool, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (float64, bool, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() float64); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func() bool); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() bool); ok { + r1 = returnFunc() } else { r1 = ret.Get(1).(bool) } - - if rf, ok := ret.Get(2).(func() error); ok { - r2 = rf() + if returnFunc, ok := ret.Get(2).(func() error); ok { + r2 = returnFunc() } else { r2 = ret.Error(2) } - return r0, r1, r2 } @@ -312,21 +393,20 @@ func (_c *CsLPPInterface_FailsafeProductionActivePowerLimit_Call) RunAndReturn(r return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *CsLPPInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -336,43 +416,48 @@ type CsLPPInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *CsLPPInterface_Expecter) IsCompatibleEntityType(entity interface{}) *CsLPPInterface_IsCompatibleEntityType_Call { return &CsLPPInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *CsLPPInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *CsLPPInterface_IsCompatibleEntityType_Call { +func (_c *CsLPPInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *CsLPPInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *CsLPPInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *CsLPPInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *CsLPPInterface_IsCompatibleEntityType_Call) Return(b bool) *CsLPPInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *CsLPPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *CsLPPInterface_IsCompatibleEntityType_Call { +func (_c *CsLPPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *CsLPPInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsHeartbeatWithinDuration provides a mock function with no fields -func (_m *CsLPPInterface) IsHeartbeatWithinDuration() bool { - ret := _m.Called() +// IsHeartbeatWithinDuration provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) IsHeartbeatWithinDuration() bool { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for IsHeartbeatWithinDuration") } var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -393,8 +478,8 @@ func (_c *CsLPPInterface_IsHeartbeatWithinDuration_Call) Run(run func()) *CsLPPI return _c } -func (_c *CsLPPInterface_IsHeartbeatWithinDuration_Call) Return(_a0 bool) *CsLPPInterface_IsHeartbeatWithinDuration_Call { - _c.Call.Return(_a0) +func (_c *CsLPPInterface_IsHeartbeatWithinDuration_Call) Return(b bool) *CsLPPInterface_IsHeartbeatWithinDuration_Call { + _c.Call.Return(b) return _c } @@ -403,21 +488,20 @@ func (_c *CsLPPInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func() return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *CsLPPInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -427,46 +511,102 @@ type CsLPPInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *CsLPPInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { return &CsLPPInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *CsLPPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *CsLPPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// PendingProductionLimits provides a mock function with no fields -func (_m *CsLPPInterface) PendingProductionLimits() map[model.MsgCounterType]api.LoadLimit { - ret := _m.Called() +// PendingDeviceConfigurations provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) PendingDeviceConfigurations() map[model.MsgCounterType][]api0.PendingDeviceConfiguration { + ret := _mock.Called() if len(ret) == 0 { - panic("no return value specified for PendingProductionLimits") + panic("no return value specified for PendingDeviceConfigurations") } - var r0 map[model.MsgCounterType]api.LoadLimit - if rf, ok := ret.Get(0).(func() map[model.MsgCounterType]api.LoadLimit); ok { - r0 = rf() + var r0 map[model.MsgCounterType][]api0.PendingDeviceConfiguration + if returnFunc, ok := ret.Get(0).(func() map[model.MsgCounterType][]api0.PendingDeviceConfiguration); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[model.MsgCounterType]api.LoadLimit) + r0 = ret.Get(0).(map[model.MsgCounterType][]api0.PendingDeviceConfiguration) } } + return r0 +} + +// CsLPPInterface_PendingDeviceConfigurations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PendingDeviceConfigurations' +type CsLPPInterface_PendingDeviceConfigurations_Call struct { + *mock.Call +} + +// PendingDeviceConfigurations is a helper method to define mock.On call +func (_e *CsLPPInterface_Expecter) PendingDeviceConfigurations() *CsLPPInterface_PendingDeviceConfigurations_Call { + return &CsLPPInterface_PendingDeviceConfigurations_Call{Call: _e.mock.On("PendingDeviceConfigurations")} +} + +func (_c *CsLPPInterface_PendingDeviceConfigurations_Call) Run(run func()) *CsLPPInterface_PendingDeviceConfigurations_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *CsLPPInterface_PendingDeviceConfigurations_Call) Return(msgCounterTypeToPendingDeviceConfigurations map[model.MsgCounterType][]api0.PendingDeviceConfiguration) *CsLPPInterface_PendingDeviceConfigurations_Call { + _c.Call.Return(msgCounterTypeToPendingDeviceConfigurations) + return _c +} +func (_c *CsLPPInterface_PendingDeviceConfigurations_Call) RunAndReturn(run func() map[model.MsgCounterType][]api0.PendingDeviceConfiguration) *CsLPPInterface_PendingDeviceConfigurations_Call { + _c.Call.Return(run) + return _c +} + +// PendingProductionLimits provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) PendingProductionLimits() map[model.MsgCounterType]api0.LoadLimit { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for PendingProductionLimits") + } + + var r0 map[model.MsgCounterType]api0.LoadLimit + if returnFunc, ok := ret.Get(0).(func() map[model.MsgCounterType]api0.LoadLimit); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[model.MsgCounterType]api0.LoadLimit) + } + } return r0 } @@ -487,41 +627,39 @@ func (_c *CsLPPInterface_PendingProductionLimits_Call) Run(run func()) *CsLPPInt return _c } -func (_c *CsLPPInterface_PendingProductionLimits_Call) Return(_a0 map[model.MsgCounterType]api.LoadLimit) *CsLPPInterface_PendingProductionLimits_Call { - _c.Call.Return(_a0) +func (_c *CsLPPInterface_PendingProductionLimits_Call) Return(msgCounterTypeToLoadLimit map[model.MsgCounterType]api0.LoadLimit) *CsLPPInterface_PendingProductionLimits_Call { + _c.Call.Return(msgCounterTypeToLoadLimit) return _c } -func (_c *CsLPPInterface_PendingProductionLimits_Call) RunAndReturn(run func() map[model.MsgCounterType]api.LoadLimit) *CsLPPInterface_PendingProductionLimits_Call { +func (_c *CsLPPInterface_PendingProductionLimits_Call) RunAndReturn(run func() map[model.MsgCounterType]api0.LoadLimit) *CsLPPInterface_PendingProductionLimits_Call { _c.Call.Return(run) return _c } -// ProductionLimit provides a mock function with no fields -func (_m *CsLPPInterface) ProductionLimit() (api.LoadLimit, error) { - ret := _m.Called() +// ProductionLimit provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) ProductionLimit() (api0.LoadLimit, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for ProductionLimit") } - var r0 api.LoadLimit + var r0 api0.LoadLimit var r1 error - if rf, ok := ret.Get(0).(func() (api.LoadLimit, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (api0.LoadLimit, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() api.LoadLimit); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() api0.LoadLimit); ok { + r0 = returnFunc() } else { - r0 = ret.Get(0).(api.LoadLimit) + r0 = ret.Get(0).(api0.LoadLimit) } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -542,19 +680,19 @@ func (_c *CsLPPInterface_ProductionLimit_Call) Run(run func()) *CsLPPInterface_P return _c } -func (_c *CsLPPInterface_ProductionLimit_Call) Return(_a0 api.LoadLimit, _a1 error) *CsLPPInterface_ProductionLimit_Call { - _c.Call.Return(_a0, _a1) +func (_c *CsLPPInterface_ProductionLimit_Call) Return(loadLimit api0.LoadLimit, err error) *CsLPPInterface_ProductionLimit_Call { + _c.Call.Return(loadLimit, err) return _c } -func (_c *CsLPPInterface_ProductionLimit_Call) RunAndReturn(run func() (api.LoadLimit, error)) *CsLPPInterface_ProductionLimit_Call { +func (_c *CsLPPInterface_ProductionLimit_Call) RunAndReturn(run func() (api0.LoadLimit, error)) *CsLPPInterface_ProductionLimit_Call { _c.Call.Return(run) return _c } -// ProductionNominalMax provides a mock function with no fields -func (_m *CsLPPInterface) ProductionNominalMax() (float64, error) { - ret := _m.Called() +// ProductionNominalMax provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) ProductionNominalMax() (float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for ProductionNominalMax") @@ -562,21 +700,19 @@ func (_m *CsLPPInterface) ProductionNominalMax() (float64, error) { var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func() (float64, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() float64); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -597,8 +733,8 @@ func (_c *CsLPPInterface_ProductionNominalMax_Call) Run(run func()) *CsLPPInterf return _c } -func (_c *CsLPPInterface_ProductionNominalMax_Call) Return(_a0 float64, _a1 error) *CsLPPInterface_ProductionNominalMax_Call { - _c.Call.Return(_a0, _a1) +func (_c *CsLPPInterface_ProductionNominalMax_Call) Return(f float64, err error) *CsLPPInterface_ProductionNominalMax_Call { + _c.Call.Return(f, err) return _c } @@ -607,23 +743,22 @@ func (_c *CsLPPInterface_ProductionNominalMax_Call) RunAndReturn(run func() (flo return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *CsLPPInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api1.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api1.RemoteEntityScenarios) } } - return r0 } @@ -644,19 +779,20 @@ func (_c *CsLPPInterface_RemoteEntitiesScenarios_Call) Run(run func()) *CsLPPInt return _c } -func (_c *CsLPPInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *CsLPPInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *CsLPPInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *CsLPPInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *CsLPPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *CsLPPInterface_RemoteEntitiesScenarios_Call { +func (_c *CsLPPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *CsLPPInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *CsLPPInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) RemoveUseCase() { + _mock.Called() + return } // CsLPPInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -686,21 +822,20 @@ func (_c *CsLPPInterface_RemoveUseCase_Call) RunAndReturn(run func()) *CsLPPInte return _c } -// SetFailsafeDurationMinimum provides a mock function with given fields: duration, changeable -func (_m *CsLPPInterface) SetFailsafeDurationMinimum(duration time.Duration, changeable bool) error { - ret := _m.Called(duration, changeable) +// SetFailsafeDurationMinimum provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) SetFailsafeDurationMinimum(duration time.Duration, changeable bool) error { + ret := _mock.Called(duration, changeable) if len(ret) == 0 { panic("no return value specified for SetFailsafeDurationMinimum") } var r0 error - if rf, ok := ret.Get(0).(func(time.Duration, bool) error); ok { - r0 = rf(duration, changeable) + if returnFunc, ok := ret.Get(0).(func(time.Duration, bool) error); ok { + r0 = returnFunc(duration, changeable) } else { r0 = ret.Error(0) } - return r0 } @@ -718,7 +853,18 @@ func (_e *CsLPPInterface_Expecter) SetFailsafeDurationMinimum(duration interface func (_c *CsLPPInterface_SetFailsafeDurationMinimum_Call) Run(run func(duration time.Duration, changeable bool)) *CsLPPInterface_SetFailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(time.Duration), args[1].(bool)) + var arg0 time.Duration + if args[0] != nil { + arg0 = args[0].(time.Duration) + } + var arg1 bool + if args[1] != nil { + arg1 = args[1].(bool) + } + run( + arg0, + arg1, + ) }) return _c } @@ -728,26 +874,25 @@ func (_c *CsLPPInterface_SetFailsafeDurationMinimum_Call) Return(resultErr error return _c } -func (_c *CsLPPInterface_SetFailsafeDurationMinimum_Call) RunAndReturn(run func(time.Duration, bool) error) *CsLPPInterface_SetFailsafeDurationMinimum_Call { +func (_c *CsLPPInterface_SetFailsafeDurationMinimum_Call) RunAndReturn(run func(duration time.Duration, changeable bool) error) *CsLPPInterface_SetFailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } -// SetFailsafeProductionActivePowerLimit provides a mock function with given fields: value, changeable -func (_m *CsLPPInterface) SetFailsafeProductionActivePowerLimit(value float64, changeable bool) error { - ret := _m.Called(value, changeable) +// SetFailsafeProductionActivePowerLimit provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) SetFailsafeProductionActivePowerLimit(value float64, changeable bool) error { + ret := _mock.Called(value, changeable) if len(ret) == 0 { panic("no return value specified for SetFailsafeProductionActivePowerLimit") } var r0 error - if rf, ok := ret.Get(0).(func(float64, bool) error); ok { - r0 = rf(value, changeable) + if returnFunc, ok := ret.Get(0).(func(float64, bool) error); ok { + r0 = returnFunc(value, changeable) } else { r0 = ret.Error(0) } - return r0 } @@ -765,7 +910,18 @@ func (_e *CsLPPInterface_Expecter) SetFailsafeProductionActivePowerLimit(value i func (_c *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call) Run(run func(value float64, changeable bool)) *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(bool)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 bool + if args[1] != nil { + arg1 = args[1].(bool) + } + run( + arg0, + arg1, + ) }) return _c } @@ -775,26 +931,25 @@ func (_c *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call) Return(resu return _c } -func (_c *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(float64, bool) error) *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call { +func (_c *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(value float64, changeable bool) error) *CsLPPInterface_SetFailsafeProductionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// SetProductionLimit provides a mock function with given fields: limit -func (_m *CsLPPInterface) SetProductionLimit(limit api.LoadLimit) error { - ret := _m.Called(limit) +// SetProductionLimit provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) SetProductionLimit(limit api0.LoadLimit) error { + ret := _mock.Called(limit) if len(ret) == 0 { panic("no return value specified for SetProductionLimit") } var r0 error - if rf, ok := ret.Get(0).(func(api.LoadLimit) error); ok { - r0 = rf(limit) + if returnFunc, ok := ret.Get(0).(func(api0.LoadLimit) error); ok { + r0 = returnFunc(limit) } else { r0 = ret.Error(0) } - return r0 } @@ -804,14 +959,20 @@ type CsLPPInterface_SetProductionLimit_Call struct { } // SetProductionLimit is a helper method to define mock.On call -// - limit api.LoadLimit +// - limit api0.LoadLimit func (_e *CsLPPInterface_Expecter) SetProductionLimit(limit interface{}) *CsLPPInterface_SetProductionLimit_Call { return &CsLPPInterface_SetProductionLimit_Call{Call: _e.mock.On("SetProductionLimit", limit)} } -func (_c *CsLPPInterface_SetProductionLimit_Call) Run(run func(limit api.LoadLimit)) *CsLPPInterface_SetProductionLimit_Call { +func (_c *CsLPPInterface_SetProductionLimit_Call) Run(run func(limit api0.LoadLimit)) *CsLPPInterface_SetProductionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(api.LoadLimit)) + var arg0 api0.LoadLimit + if args[0] != nil { + arg0 = args[0].(api0.LoadLimit) + } + run( + arg0, + ) }) return _c } @@ -821,26 +982,25 @@ func (_c *CsLPPInterface_SetProductionLimit_Call) Return(resultErr error) *CsLPP return _c } -func (_c *CsLPPInterface_SetProductionLimit_Call) RunAndReturn(run func(api.LoadLimit) error) *CsLPPInterface_SetProductionLimit_Call { +func (_c *CsLPPInterface_SetProductionLimit_Call) RunAndReturn(run func(limit api0.LoadLimit) error) *CsLPPInterface_SetProductionLimit_Call { _c.Call.Return(run) return _c } -// SetProductionNominalMax provides a mock function with given fields: value -func (_m *CsLPPInterface) SetProductionNominalMax(value float64) error { - ret := _m.Called(value) +// SetProductionNominalMax provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) SetProductionNominalMax(value float64) error { + ret := _mock.Called(value) if len(ret) == 0 { panic("no return value specified for SetProductionNominalMax") } var r0 error - if rf, ok := ret.Get(0).(func(float64) error); ok { - r0 = rf(value) + if returnFunc, ok := ret.Get(0).(func(float64) error); ok { + r0 = returnFunc(value) } else { r0 = ret.Error(0) } - return r0 } @@ -857,7 +1017,13 @@ func (_e *CsLPPInterface_Expecter) SetProductionNominalMax(value interface{}) *C func (_c *CsLPPInterface_SetProductionNominalMax_Call) Run(run func(value float64)) *CsLPPInterface_SetProductionNominalMax_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + run( + arg0, + ) }) return _c } @@ -867,14 +1033,15 @@ func (_c *CsLPPInterface_SetProductionNominalMax_Call) Return(resultErr error) * return _c } -func (_c *CsLPPInterface_SetProductionNominalMax_Call) RunAndReturn(run func(float64) error) *CsLPPInterface_SetProductionNominalMax_Call { +func (_c *CsLPPInterface_SetProductionNominalMax_Call) RunAndReturn(run func(value float64) error) *CsLPPInterface_SetProductionNominalMax_Call { _c.Call.Return(run) return _c } -// StartHeartbeat provides a mock function with no fields -func (_m *CsLPPInterface) StartHeartbeat() { - _m.Called() +// StartHeartbeat provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) StartHeartbeat() { + _mock.Called() + return } // CsLPPInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -904,9 +1071,10 @@ func (_c *CsLPPInterface_StartHeartbeat_Call) RunAndReturn(run func()) *CsLPPInt return _c } -// StopHeartbeat provides a mock function with no fields -func (_m *CsLPPInterface) StopHeartbeat() { - _m.Called() +// StopHeartbeat provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) StopHeartbeat() { + _mock.Called() + return } // CsLPPInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -936,9 +1104,10 @@ func (_c *CsLPPInterface_StopHeartbeat_Call) RunAndReturn(run func()) *CsLPPInte return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *CsLPPInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type CsLPPInterface +func (_mock *CsLPPInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // CsLPPInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -954,7 +1123,13 @@ func (_e *CsLPPInterface_Expecter) UpdateUseCaseAvailability(available interface func (_c *CsLPPInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *CsLPPInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -964,21 +1139,7 @@ func (_c *CsLPPInterface_UpdateUseCaseAvailability_Call) Return() *CsLPPInterfac return _c } -func (_c *CsLPPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *CsLPPInterface_UpdateUseCaseAvailability_Call { +func (_c *CsLPPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *CsLPPInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } - -// NewCsLPPInterface creates a new instance of CsLPPInterface. 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 NewCsLPPInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *CsLPPInterface { - mock := &CsLPPInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/EgLPCInterface.go b/usecases/mocks/EgLPCInterface.go index 3633f240..f88e5516 100644 --- a/usecases/mocks/EgLPCInterface.go +++ b/usecases/mocks/EgLPCInterface.go @@ -1,19 +1,32 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" - api "github.com/enbility/eebus-go/usecases/api" + "time" + api1 "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" +) - model "github.com/enbility/spine-go/model" +// NewEgLPCInterface creates a new instance of EgLPCInterface. 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 NewEgLPCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *EgLPCInterface { + mock := &EgLPCInterface{} + mock.Mock.Test(t) - spine_goapi "github.com/enbility/spine-go/api" + t.Cleanup(func() { mock.AssertExpectations(t) }) - time "time" -) + return mock +} // EgLPCInterface is an autogenerated mock type for the EgLPCInterface type type EgLPCInterface struct { @@ -28,21 +41,20 @@ func (_m *EgLPCInterface) EXPECT() *EgLPCInterface_Expecter { return &EgLPCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *EgLPCInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -63,8 +75,8 @@ func (_c *EgLPCInterface_AddFeatures_Call) Run(run func()) *EgLPCInterface_AddFe return _c } -func (_c *EgLPCInterface_AddFeatures_Call) Return(_a0 error) *EgLPCInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *EgLPCInterface_AddFeatures_Call) Return(err error) *EgLPCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -73,9 +85,10 @@ func (_c *EgLPCInterface_AddFeatures_Call) RunAndReturn(run func() error) *EgLPC return _c } -// AddUseCase provides a mock function with no fields -func (_m *EgLPCInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) AddUseCase() { + _mock.Called() + return } // EgLPCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -105,23 +118,22 @@ func (_c *EgLPCInterface_AddUseCase_Call) RunAndReturn(run func()) *EgLPCInterfa return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *EgLPCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -131,53 +143,57 @@ type EgLPCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *EgLPCInterface_AvailableScenariosForEntity_Call { return &EgLPCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_AvailableScenariosForEntity_Call { +func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *EgLPCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *EgLPCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *EgLPCInterface_AvailableScenariosForEntity_Call { +func (_c *EgLPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *EgLPCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// ConsumptionLimit provides a mock function with given fields: entity -func (_m *EgLPCInterface) ConsumptionLimit(entity spine_goapi.EntityRemoteInterface) (api.LoadLimit, error) { - ret := _m.Called(entity) +// ConsumptionLimit provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) ConsumptionLimit(entity api.EntityRemoteInterface) (api0.LoadLimit, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for ConsumptionLimit") } - var r0 api.LoadLimit + var r0 api0.LoadLimit var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.LoadLimit, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.LoadLimit, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.LoadLimit); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.LoadLimit); ok { + r0 = returnFunc(entity) } else { - r0 = ret.Get(0).(api.LoadLimit) + r0 = ret.Get(0).(api0.LoadLimit) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -187,31 +203,37 @@ type EgLPCInterface_ConsumptionLimit_Call struct { } // ConsumptionLimit is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) ConsumptionLimit(entity interface{}) *EgLPCInterface_ConsumptionLimit_Call { return &EgLPCInterface_ConsumptionLimit_Call{Call: _e.mock.On("ConsumptionLimit", entity)} } -func (_c *EgLPCInterface_ConsumptionLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_ConsumptionLimit_Call { +func (_c *EgLPCInterface_ConsumptionLimit_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_ConsumptionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPCInterface_ConsumptionLimit_Call) Return(limit api.LoadLimit, resultErr error) *EgLPCInterface_ConsumptionLimit_Call { +func (_c *EgLPCInterface_ConsumptionLimit_Call) Return(limit api0.LoadLimit, resultErr error) *EgLPCInterface_ConsumptionLimit_Call { _c.Call.Return(limit, resultErr) return _c } -func (_c *EgLPCInterface_ConsumptionLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.LoadLimit, error)) *EgLPCInterface_ConsumptionLimit_Call { +func (_c *EgLPCInterface_ConsumptionLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.LoadLimit, error)) *EgLPCInterface_ConsumptionLimit_Call { _c.Call.Return(run) return _c } -// ConsumptionNominalMax provides a mock function with given fields: entity -func (_m *EgLPCInterface) ConsumptionNominalMax(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// ConsumptionNominalMax provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) ConsumptionNominalMax(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for ConsumptionNominalMax") @@ -219,21 +241,19 @@ func (_m *EgLPCInterface) ConsumptionNominalMax(entity spine_goapi.EntityRemoteI var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -243,31 +263,37 @@ type EgLPCInterface_ConsumptionNominalMax_Call struct { } // ConsumptionNominalMax is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) ConsumptionNominalMax(entity interface{}) *EgLPCInterface_ConsumptionNominalMax_Call { return &EgLPCInterface_ConsumptionNominalMax_Call{Call: _e.mock.On("ConsumptionNominalMax", entity)} } -func (_c *EgLPCInterface_ConsumptionNominalMax_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_ConsumptionNominalMax_Call { +func (_c *EgLPCInterface_ConsumptionNominalMax_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_ConsumptionNominalMax_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPCInterface_ConsumptionNominalMax_Call) Return(_a0 float64, _a1 error) *EgLPCInterface_ConsumptionNominalMax_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPCInterface_ConsumptionNominalMax_Call) Return(f float64, err error) *EgLPCInterface_ConsumptionNominalMax_Call { + _c.Call.Return(f, err) return _c } -func (_c *EgLPCInterface_ConsumptionNominalMax_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *EgLPCInterface_ConsumptionNominalMax_Call { +func (_c *EgLPCInterface_ConsumptionNominalMax_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *EgLPCInterface_ConsumptionNominalMax_Call { _c.Call.Return(run) return _c } -// FailsafeConsumptionActivePowerLimit provides a mock function with given fields: entity -func (_m *EgLPCInterface) FailsafeConsumptionActivePowerLimit(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// FailsafeConsumptionActivePowerLimit provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) FailsafeConsumptionActivePowerLimit(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for FailsafeConsumptionActivePowerLimit") @@ -275,21 +301,19 @@ func (_m *EgLPCInterface) FailsafeConsumptionActivePowerLimit(entity spine_goapi var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -299,31 +323,37 @@ type EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call struct { } // FailsafeConsumptionActivePowerLimit is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) FailsafeConsumptionActivePowerLimit(entity interface{}) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { return &EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call{Call: _e.mock.On("FailsafeConsumptionActivePowerLimit", entity)} } -func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { +func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) Return(_a0 float64, _a1 error) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) Return(f float64, err error) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { + _c.Call.Return(f, err) return _c } -func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { +func (_c *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *EgLPCInterface_FailsafeConsumptionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// FailsafeDurationMinimum provides a mock function with given fields: entity -func (_m *EgLPCInterface) FailsafeDurationMinimum(entity spine_goapi.EntityRemoteInterface) (time.Duration, error) { - ret := _m.Called(entity) +// FailsafeDurationMinimum provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) FailsafeDurationMinimum(entity api.EntityRemoteInterface) (time.Duration, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for FailsafeDurationMinimum") @@ -331,21 +361,19 @@ func (_m *EgLPCInterface) FailsafeDurationMinimum(entity spine_goapi.EntityRemot var r0 time.Duration var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (time.Duration, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (time.Duration, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) time.Duration); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) time.Duration); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(time.Duration) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -355,43 +383,48 @@ type EgLPCInterface_FailsafeDurationMinimum_Call struct { } // FailsafeDurationMinimum is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) FailsafeDurationMinimum(entity interface{}) *EgLPCInterface_FailsafeDurationMinimum_Call { return &EgLPCInterface_FailsafeDurationMinimum_Call{Call: _e.mock.On("FailsafeDurationMinimum", entity)} } -func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_FailsafeDurationMinimum_Call { +func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_FailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) Return(_a0 time.Duration, _a1 error) *EgLPCInterface_FailsafeDurationMinimum_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) Return(duration time.Duration, err error) *EgLPCInterface_FailsafeDurationMinimum_Call { + _c.Call.Return(duration, err) return _c } -func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (time.Duration, error)) *EgLPCInterface_FailsafeDurationMinimum_Call { +func (_c *EgLPCInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (time.Duration, error)) *EgLPCInterface_FailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *EgLPCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -401,43 +434,48 @@ type EgLPCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *EgLPCInterface_IsCompatibleEntityType_Call { return &EgLPCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *EgLPCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_IsCompatibleEntityType_Call { +func (_c *EgLPCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *EgLPCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *EgLPCInterface_IsCompatibleEntityType_Call) Return(b bool) *EgLPCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *EgLPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *EgLPCInterface_IsCompatibleEntityType_Call { +func (_c *EgLPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *EgLPCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsHeartbeatWithinDuration provides a mock function with given fields: entity -func (_m *EgLPCInterface) IsHeartbeatWithinDuration(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsHeartbeatWithinDuration provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) IsHeartbeatWithinDuration(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsHeartbeatWithinDuration") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -447,43 +485,48 @@ type EgLPCInterface_IsHeartbeatWithinDuration_Call struct { } // IsHeartbeatWithinDuration is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPCInterface_Expecter) IsHeartbeatWithinDuration(entity interface{}) *EgLPCInterface_IsHeartbeatWithinDuration_Call { return &EgLPCInterface_IsHeartbeatWithinDuration_Call{Call: _e.mock.On("IsHeartbeatWithinDuration", entity)} } -func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPCInterface_IsHeartbeatWithinDuration_Call { +func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPCInterface_IsHeartbeatWithinDuration_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) Return(_a0 bool) *EgLPCInterface_IsHeartbeatWithinDuration_Call { - _c.Call.Return(_a0) +func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) Return(b bool) *EgLPCInterface_IsHeartbeatWithinDuration_Call { + _c.Call.Return(b) return _c } -func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *EgLPCInterface_IsHeartbeatWithinDuration_Call { +func (_c *EgLPCInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *EgLPCInterface_IsHeartbeatWithinDuration_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *EgLPCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -493,46 +536,56 @@ type EgLPCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *EgLPCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { return &EgLPCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *EgLPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *EgLPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *EgLPCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api1.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api1.RemoteEntityScenarios) } } - return r0 } @@ -553,19 +606,20 @@ func (_c *EgLPCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *EgLPCInt return _c } -func (_c *EgLPCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *EgLPCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *EgLPCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *EgLPCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *EgLPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *EgLPCInterface_RemoteEntitiesScenarios_Call { +func (_c *EgLPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *EgLPCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *EgLPCInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) RemoveUseCase() { + _mock.Called() + return } // EgLPCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -595,9 +649,10 @@ func (_c *EgLPCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *EgLPCInte return _c } -// StartHeartbeat provides a mock function with no fields -func (_m *EgLPCInterface) StartHeartbeat() { - _m.Called() +// StartHeartbeat provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) StartHeartbeat() { + _mock.Called() + return } // EgLPCInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -627,9 +682,10 @@ func (_c *EgLPCInterface_StartHeartbeat_Call) RunAndReturn(run func()) *EgLPCInt return _c } -// StopHeartbeat provides a mock function with no fields -func (_m *EgLPCInterface) StopHeartbeat() { - _m.Called() +// StopHeartbeat provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) StopHeartbeat() { + _mock.Called() + return } // EgLPCInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -659,9 +715,10 @@ func (_c *EgLPCInterface_StopHeartbeat_Call) RunAndReturn(run func()) *EgLPCInte return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *EgLPCInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // EgLPCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -677,7 +734,13 @@ func (_e *EgLPCInterface_Expecter) UpdateUseCaseAvailability(available interface func (_c *EgLPCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *EgLPCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -687,14 +750,14 @@ func (_c *EgLPCInterface_UpdateUseCaseAvailability_Call) Return() *EgLPCInterfac return _c } -func (_c *EgLPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *EgLPCInterface_UpdateUseCaseAvailability_Call { +func (_c *EgLPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *EgLPCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// WriteConsumptionLimit provides a mock function with given fields: entity, limit, resultCB -func (_m *EgLPCInterface) WriteConsumptionLimit(entity spine_goapi.EntityRemoteInterface, limit api.LoadLimit, resultCB func(model.ResultDataType)) (*model.MsgCounterType, error) { - ret := _m.Called(entity, limit, resultCB) +// WriteConsumptionLimit provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) WriteConsumptionLimit(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error) { + ret := _mock.Called(entity, limit, resultCB) if len(ret) == 0 { panic("no return value specified for WriteConsumptionLimit") @@ -702,23 +765,21 @@ func (_m *EgLPCInterface) WriteConsumptionLimit(entity spine_goapi.EntityRemoteI var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) (*model.MsgCounterType, error)); ok { - return rf(entity, limit, resultCB) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) (*model.MsgCounterType, error)); ok { + return returnFunc(entity, limit, resultCB) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) *model.MsgCounterType); ok { - r0 = rf(entity, limit, resultCB) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) *model.MsgCounterType); ok { + r0 = returnFunc(entity, limit, resultCB) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) error); ok { - r1 = rf(entity, limit, resultCB) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) error); ok { + r1 = returnFunc(entity, limit, resultCB) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -728,33 +789,49 @@ type EgLPCInterface_WriteConsumptionLimit_Call struct { } // WriteConsumptionLimit is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -// - limit api.LoadLimit -// - resultCB func(model.ResultDataType) +// - entity api.EntityRemoteInterface +// - limit api0.LoadLimit +// - resultCB func(result model.ResultDataType) func (_e *EgLPCInterface_Expecter) WriteConsumptionLimit(entity interface{}, limit interface{}, resultCB interface{}) *EgLPCInterface_WriteConsumptionLimit_Call { return &EgLPCInterface_WriteConsumptionLimit_Call{Call: _e.mock.On("WriteConsumptionLimit", entity, limit, resultCB)} } -func (_c *EgLPCInterface_WriteConsumptionLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, limit api.LoadLimit, resultCB func(model.ResultDataType))) *EgLPCInterface_WriteConsumptionLimit_Call { +func (_c *EgLPCInterface_WriteConsumptionLimit_Call) Run(run func(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType))) *EgLPCInterface_WriteConsumptionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(api.LoadLimit), args[2].(func(model.ResultDataType))) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 api0.LoadLimit + if args[1] != nil { + arg1 = args[1].(api0.LoadLimit) + } + var arg2 func(result model.ResultDataType) + if args[2] != nil { + arg2 = args[2].(func(result model.ResultDataType)) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *EgLPCInterface_WriteConsumptionLimit_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPCInterface_WriteConsumptionLimit_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPCInterface_WriteConsumptionLimit_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPCInterface_WriteConsumptionLimit_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *EgLPCInterface_WriteConsumptionLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) (*model.MsgCounterType, error)) *EgLPCInterface_WriteConsumptionLimit_Call { +func (_c *EgLPCInterface_WriteConsumptionLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error)) *EgLPCInterface_WriteConsumptionLimit_Call { _c.Call.Return(run) return _c } -// WriteFailsafeConsumptionActivePowerLimit provides a mock function with given fields: entity, value -func (_m *EgLPCInterface) WriteFailsafeConsumptionActivePowerLimit(entity spine_goapi.EntityRemoteInterface, value float64) (*model.MsgCounterType, error) { - ret := _m.Called(entity, value) +// WriteFailsafeConsumptionActivePowerLimit provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) WriteFailsafeConsumptionActivePowerLimit(entity api.EntityRemoteInterface, value float64) (*model.MsgCounterType, error) { + ret := _mock.Called(entity, value) if len(ret) == 0 { panic("no return value specified for WriteFailsafeConsumptionActivePowerLimit") @@ -762,23 +839,21 @@ func (_m *EgLPCInterface) WriteFailsafeConsumptionActivePowerLimit(entity spine_ var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, float64) (*model.MsgCounterType, error)); ok { - return rf(entity, value) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, float64) (*model.MsgCounterType, error)); ok { + return returnFunc(entity, value) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, float64) *model.MsgCounterType); ok { - r0 = rf(entity, value) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, float64) *model.MsgCounterType); ok { + r0 = returnFunc(entity, value) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, float64) error); ok { - r1 = rf(entity, value) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, float64) error); ok { + r1 = returnFunc(entity, value) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -788,32 +863,43 @@ type EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call struct { } // WriteFailsafeConsumptionActivePowerLimit is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - value float64 func (_e *EgLPCInterface_Expecter) WriteFailsafeConsumptionActivePowerLimit(entity interface{}, value interface{}) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { return &EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call{Call: _e.mock.On("WriteFailsafeConsumptionActivePowerLimit", entity, value)} } -func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, value float64)) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { +func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) Run(run func(entity api.EntityRemoteInterface, value float64)) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(float64)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 float64 + if args[1] != nil { + arg1 = args[1].(float64) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, float64) (*model.MsgCounterType, error)) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { +func (_c *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, value float64) (*model.MsgCounterType, error)) *EgLPCInterface_WriteFailsafeConsumptionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// WriteFailsafeDurationMinimum provides a mock function with given fields: entity, duration -func (_m *EgLPCInterface) WriteFailsafeDurationMinimum(entity spine_goapi.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error) { - ret := _m.Called(entity, duration) +// WriteFailsafeDurationMinimum provides a mock function for the type EgLPCInterface +func (_mock *EgLPCInterface) WriteFailsafeDurationMinimum(entity api.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error) { + ret := _mock.Called(entity, duration) if len(ret) == 0 { panic("no return value specified for WriteFailsafeDurationMinimum") @@ -821,23 +907,21 @@ func (_m *EgLPCInterface) WriteFailsafeDurationMinimum(entity spine_goapi.Entity var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)); ok { - return rf(entity, duration) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)); ok { + return returnFunc(entity, duration) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, time.Duration) *model.MsgCounterType); ok { - r0 = rf(entity, duration) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, time.Duration) *model.MsgCounterType); ok { + r0 = returnFunc(entity, duration) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, time.Duration) error); ok { - r1 = rf(entity, duration) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, time.Duration) error); ok { + r1 = returnFunc(entity, duration) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -847,39 +931,36 @@ type EgLPCInterface_WriteFailsafeDurationMinimum_Call struct { } // WriteFailsafeDurationMinimum is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - duration time.Duration func (_e *EgLPCInterface_Expecter) WriteFailsafeDurationMinimum(entity interface{}, duration interface{}) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { return &EgLPCInterface_WriteFailsafeDurationMinimum_Call{Call: _e.mock.On("WriteFailsafeDurationMinimum", entity, duration)} } -func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, duration time.Duration)) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { +func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) Run(run func(entity api.EntityRemoteInterface, duration time.Duration)) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(time.Duration)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 time.Duration + if args[1] != nil { + arg1 = args[1].(time.Duration) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { +func (_c *EgLPCInterface_WriteFailsafeDurationMinimum_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error)) *EgLPCInterface_WriteFailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } - -// NewEgLPCInterface creates a new instance of EgLPCInterface. 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 NewEgLPCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *EgLPCInterface { - mock := &EgLPCInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/EgLPPInterface.go b/usecases/mocks/EgLPPInterface.go index 66b8dccb..d6fdc86a 100644 --- a/usecases/mocks/EgLPPInterface.go +++ b/usecases/mocks/EgLPPInterface.go @@ -1,19 +1,32 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" - api "github.com/enbility/eebus-go/usecases/api" + "time" + api1 "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" +) - model "github.com/enbility/spine-go/model" +// NewEgLPPInterface creates a new instance of EgLPPInterface. 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 NewEgLPPInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *EgLPPInterface { + mock := &EgLPPInterface{} + mock.Mock.Test(t) - spine_goapi "github.com/enbility/spine-go/api" + t.Cleanup(func() { mock.AssertExpectations(t) }) - time "time" -) + return mock +} // EgLPPInterface is an autogenerated mock type for the EgLPPInterface type type EgLPPInterface struct { @@ -28,21 +41,20 @@ func (_m *EgLPPInterface) EXPECT() *EgLPPInterface_Expecter { return &EgLPPInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *EgLPPInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -63,8 +75,8 @@ func (_c *EgLPPInterface_AddFeatures_Call) Run(run func()) *EgLPPInterface_AddFe return _c } -func (_c *EgLPPInterface_AddFeatures_Call) Return(_a0 error) *EgLPPInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *EgLPPInterface_AddFeatures_Call) Return(err error) *EgLPPInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -73,9 +85,10 @@ func (_c *EgLPPInterface_AddFeatures_Call) RunAndReturn(run func() error) *EgLPP return _c } -// AddUseCase provides a mock function with no fields -func (_m *EgLPPInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) AddUseCase() { + _mock.Called() + return } // EgLPPInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -105,23 +118,22 @@ func (_c *EgLPPInterface_AddUseCase_Call) RunAndReturn(run func()) *EgLPPInterfa return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *EgLPPInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -131,31 +143,37 @@ type EgLPPInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *EgLPPInterface_AvailableScenariosForEntity_Call { return &EgLPPInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_AvailableScenariosForEntity_Call { +func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *EgLPPInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *EgLPPInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *EgLPPInterface_AvailableScenariosForEntity_Call { +func (_c *EgLPPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *EgLPPInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// FailsafeDurationMinimum provides a mock function with given fields: entity -func (_m *EgLPPInterface) FailsafeDurationMinimum(entity spine_goapi.EntityRemoteInterface) (time.Duration, error) { - ret := _m.Called(entity) +// FailsafeDurationMinimum provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) FailsafeDurationMinimum(entity api.EntityRemoteInterface) (time.Duration, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for FailsafeDurationMinimum") @@ -163,21 +181,19 @@ func (_m *EgLPPInterface) FailsafeDurationMinimum(entity spine_goapi.EntityRemot var r0 time.Duration var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (time.Duration, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (time.Duration, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) time.Duration); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) time.Duration); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(time.Duration) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -187,31 +203,37 @@ type EgLPPInterface_FailsafeDurationMinimum_Call struct { } // FailsafeDurationMinimum is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) FailsafeDurationMinimum(entity interface{}) *EgLPPInterface_FailsafeDurationMinimum_Call { return &EgLPPInterface_FailsafeDurationMinimum_Call{Call: _e.mock.On("FailsafeDurationMinimum", entity)} } -func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_FailsafeDurationMinimum_Call { +func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_FailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) Return(_a0 time.Duration, _a1 error) *EgLPPInterface_FailsafeDurationMinimum_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) Return(duration time.Duration, err error) *EgLPPInterface_FailsafeDurationMinimum_Call { + _c.Call.Return(duration, err) return _c } -func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (time.Duration, error)) *EgLPPInterface_FailsafeDurationMinimum_Call { +func (_c *EgLPPInterface_FailsafeDurationMinimum_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (time.Duration, error)) *EgLPPInterface_FailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } -// FailsafeProductionActivePowerLimit provides a mock function with given fields: entity -func (_m *EgLPPInterface) FailsafeProductionActivePowerLimit(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// FailsafeProductionActivePowerLimit provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) FailsafeProductionActivePowerLimit(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for FailsafeProductionActivePowerLimit") @@ -219,21 +241,19 @@ func (_m *EgLPPInterface) FailsafeProductionActivePowerLimit(entity spine_goapi. var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -243,43 +263,48 @@ type EgLPPInterface_FailsafeProductionActivePowerLimit_Call struct { } // FailsafeProductionActivePowerLimit is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) FailsafeProductionActivePowerLimit(entity interface{}) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { return &EgLPPInterface_FailsafeProductionActivePowerLimit_Call{Call: _e.mock.On("FailsafeProductionActivePowerLimit", entity)} } -func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { +func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) Return(_a0 float64, _a1 error) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) Return(f float64, err error) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { + _c.Call.Return(f, err) return _c } -func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { +func (_c *EgLPPInterface_FailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *EgLPPInterface_FailsafeProductionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *EgLPPInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -289,43 +314,48 @@ type EgLPPInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) IsCompatibleEntityType(entity interface{}) *EgLPPInterface_IsCompatibleEntityType_Call { return &EgLPPInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *EgLPPInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_IsCompatibleEntityType_Call { +func (_c *EgLPPInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPPInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *EgLPPInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *EgLPPInterface_IsCompatibleEntityType_Call) Return(b bool) *EgLPPInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *EgLPPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *EgLPPInterface_IsCompatibleEntityType_Call { +func (_c *EgLPPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *EgLPPInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsHeartbeatWithinDuration provides a mock function with given fields: entity -func (_m *EgLPPInterface) IsHeartbeatWithinDuration(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsHeartbeatWithinDuration provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) IsHeartbeatWithinDuration(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsHeartbeatWithinDuration") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -335,43 +365,48 @@ type EgLPPInterface_IsHeartbeatWithinDuration_Call struct { } // IsHeartbeatWithinDuration is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) IsHeartbeatWithinDuration(entity interface{}) *EgLPPInterface_IsHeartbeatWithinDuration_Call { return &EgLPPInterface_IsHeartbeatWithinDuration_Call{Call: _e.mock.On("IsHeartbeatWithinDuration", entity)} } -func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_IsHeartbeatWithinDuration_Call { +func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_IsHeartbeatWithinDuration_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) Return(_a0 bool) *EgLPPInterface_IsHeartbeatWithinDuration_Call { - _c.Call.Return(_a0) +func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) Return(b bool) *EgLPPInterface_IsHeartbeatWithinDuration_Call { + _c.Call.Return(b) return _c } -func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *EgLPPInterface_IsHeartbeatWithinDuration_Call { +func (_c *EgLPPInterface_IsHeartbeatWithinDuration_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *EgLPPInterface_IsHeartbeatWithinDuration_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *EgLPPInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -381,54 +416,63 @@ type EgLPPInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *EgLPPInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { return &EgLPPInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *EgLPPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *EgLPPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// ProductionLimit provides a mock function with given fields: entity -func (_m *EgLPPInterface) ProductionLimit(entity spine_goapi.EntityRemoteInterface) (api.LoadLimit, error) { - ret := _m.Called(entity) +// ProductionLimit provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) ProductionLimit(entity api.EntityRemoteInterface) (api0.LoadLimit, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for ProductionLimit") } - var r0 api.LoadLimit + var r0 api0.LoadLimit var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (api.LoadLimit, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (api0.LoadLimit, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) api.LoadLimit); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) api0.LoadLimit); ok { + r0 = returnFunc(entity) } else { - r0 = ret.Get(0).(api.LoadLimit) + r0 = ret.Get(0).(api0.LoadLimit) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -438,31 +482,37 @@ type EgLPPInterface_ProductionLimit_Call struct { } // ProductionLimit is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) ProductionLimit(entity interface{}) *EgLPPInterface_ProductionLimit_Call { return &EgLPPInterface_ProductionLimit_Call{Call: _e.mock.On("ProductionLimit", entity)} } -func (_c *EgLPPInterface_ProductionLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_ProductionLimit_Call { +func (_c *EgLPPInterface_ProductionLimit_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_ProductionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPPInterface_ProductionLimit_Call) Return(limit api.LoadLimit, resultErr error) *EgLPPInterface_ProductionLimit_Call { +func (_c *EgLPPInterface_ProductionLimit_Call) Return(limit api0.LoadLimit, resultErr error) *EgLPPInterface_ProductionLimit_Call { _c.Call.Return(limit, resultErr) return _c } -func (_c *EgLPPInterface_ProductionLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (api.LoadLimit, error)) *EgLPPInterface_ProductionLimit_Call { +func (_c *EgLPPInterface_ProductionLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (api0.LoadLimit, error)) *EgLPPInterface_ProductionLimit_Call { _c.Call.Return(run) return _c } -// ProductionNominalMax provides a mock function with given fields: entity -func (_m *EgLPPInterface) ProductionNominalMax(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// ProductionNominalMax provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) ProductionNominalMax(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for ProductionNominalMax") @@ -470,21 +520,19 @@ func (_m *EgLPPInterface) ProductionNominalMax(entity spine_goapi.EntityRemoteIn var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -494,45 +542,50 @@ type EgLPPInterface_ProductionNominalMax_Call struct { } // ProductionNominalMax is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *EgLPPInterface_Expecter) ProductionNominalMax(entity interface{}) *EgLPPInterface_ProductionNominalMax_Call { return &EgLPPInterface_ProductionNominalMax_Call{Call: _e.mock.On("ProductionNominalMax", entity)} } -func (_c *EgLPPInterface_ProductionNominalMax_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *EgLPPInterface_ProductionNominalMax_Call { +func (_c *EgLPPInterface_ProductionNominalMax_Call) Run(run func(entity api.EntityRemoteInterface)) *EgLPPInterface_ProductionNominalMax_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *EgLPPInterface_ProductionNominalMax_Call) Return(_a0 float64, _a1 error) *EgLPPInterface_ProductionNominalMax_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPPInterface_ProductionNominalMax_Call) Return(f float64, err error) *EgLPPInterface_ProductionNominalMax_Call { + _c.Call.Return(f, err) return _c } -func (_c *EgLPPInterface_ProductionNominalMax_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *EgLPPInterface_ProductionNominalMax_Call { +func (_c *EgLPPInterface_ProductionNominalMax_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *EgLPPInterface_ProductionNominalMax_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *EgLPPInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) RemoteEntitiesScenarios() []api1.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api1.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api1.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api1.RemoteEntityScenarios) } } - return r0 } @@ -553,19 +606,20 @@ func (_c *EgLPPInterface_RemoteEntitiesScenarios_Call) Run(run func()) *EgLPPInt return _c } -func (_c *EgLPPInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *EgLPPInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *EgLPPInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api1.RemoteEntityScenarios) *EgLPPInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *EgLPPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *EgLPPInterface_RemoteEntitiesScenarios_Call { +func (_c *EgLPPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api1.RemoteEntityScenarios) *EgLPPInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *EgLPPInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) RemoveUseCase() { + _mock.Called() + return } // EgLPPInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -595,9 +649,10 @@ func (_c *EgLPPInterface_RemoveUseCase_Call) RunAndReturn(run func()) *EgLPPInte return _c } -// StartHeartbeat provides a mock function with no fields -func (_m *EgLPPInterface) StartHeartbeat() { - _m.Called() +// StartHeartbeat provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) StartHeartbeat() { + _mock.Called() + return } // EgLPPInterface_StartHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartHeartbeat' @@ -627,9 +682,10 @@ func (_c *EgLPPInterface_StartHeartbeat_Call) RunAndReturn(run func()) *EgLPPInt return _c } -// StopHeartbeat provides a mock function with no fields -func (_m *EgLPPInterface) StopHeartbeat() { - _m.Called() +// StopHeartbeat provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) StopHeartbeat() { + _mock.Called() + return } // EgLPPInterface_StopHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopHeartbeat' @@ -659,9 +715,10 @@ func (_c *EgLPPInterface_StopHeartbeat_Call) RunAndReturn(run func()) *EgLPPInte return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *EgLPPInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // EgLPPInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -677,7 +734,13 @@ func (_e *EgLPPInterface_Expecter) UpdateUseCaseAvailability(available interface func (_c *EgLPPInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *EgLPPInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -687,14 +750,14 @@ func (_c *EgLPPInterface_UpdateUseCaseAvailability_Call) Return() *EgLPPInterfac return _c } -func (_c *EgLPPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *EgLPPInterface_UpdateUseCaseAvailability_Call { +func (_c *EgLPPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *EgLPPInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// WriteFailsafeDurationMinimum provides a mock function with given fields: entity, duration -func (_m *EgLPPInterface) WriteFailsafeDurationMinimum(entity spine_goapi.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error) { - ret := _m.Called(entity, duration) +// WriteFailsafeDurationMinimum provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) WriteFailsafeDurationMinimum(entity api.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error) { + ret := _mock.Called(entity, duration) if len(ret) == 0 { panic("no return value specified for WriteFailsafeDurationMinimum") @@ -702,23 +765,21 @@ func (_m *EgLPPInterface) WriteFailsafeDurationMinimum(entity spine_goapi.Entity var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)); ok { - return rf(entity, duration) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)); ok { + return returnFunc(entity, duration) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, time.Duration) *model.MsgCounterType); ok { - r0 = rf(entity, duration) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, time.Duration) *model.MsgCounterType); ok { + r0 = returnFunc(entity, duration) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, time.Duration) error); ok { - r1 = rf(entity, duration) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, time.Duration) error); ok { + r1 = returnFunc(entity, duration) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -728,32 +789,43 @@ type EgLPPInterface_WriteFailsafeDurationMinimum_Call struct { } // WriteFailsafeDurationMinimum is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - duration time.Duration func (_e *EgLPPInterface_Expecter) WriteFailsafeDurationMinimum(entity interface{}, duration interface{}) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { return &EgLPPInterface_WriteFailsafeDurationMinimum_Call{Call: _e.mock.On("WriteFailsafeDurationMinimum", entity, duration)} } -func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, duration time.Duration)) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { +func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) Run(run func(entity api.EntityRemoteInterface, duration time.Duration)) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(time.Duration)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 time.Duration + if args[1] != nil { + arg1 = args[1].(time.Duration) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, time.Duration) (*model.MsgCounterType, error)) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { +func (_c *EgLPPInterface_WriteFailsafeDurationMinimum_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, duration time.Duration) (*model.MsgCounterType, error)) *EgLPPInterface_WriteFailsafeDurationMinimum_Call { _c.Call.Return(run) return _c } -// WriteFailsafeProductionActivePowerLimit provides a mock function with given fields: entity, value -func (_m *EgLPPInterface) WriteFailsafeProductionActivePowerLimit(entity spine_goapi.EntityRemoteInterface, value float64) (*model.MsgCounterType, error) { - ret := _m.Called(entity, value) +// WriteFailsafeProductionActivePowerLimit provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) WriteFailsafeProductionActivePowerLimit(entity api.EntityRemoteInterface, value float64) (*model.MsgCounterType, error) { + ret := _mock.Called(entity, value) if len(ret) == 0 { panic("no return value specified for WriteFailsafeProductionActivePowerLimit") @@ -761,23 +833,21 @@ func (_m *EgLPPInterface) WriteFailsafeProductionActivePowerLimit(entity spine_g var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, float64) (*model.MsgCounterType, error)); ok { - return rf(entity, value) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, float64) (*model.MsgCounterType, error)); ok { + return returnFunc(entity, value) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, float64) *model.MsgCounterType); ok { - r0 = rf(entity, value) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, float64) *model.MsgCounterType); ok { + r0 = returnFunc(entity, value) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, float64) error); ok { - r1 = rf(entity, value) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, float64) error); ok { + r1 = returnFunc(entity, value) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -787,32 +857,43 @@ type EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call struct { } // WriteFailsafeProductionActivePowerLimit is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - value float64 func (_e *EgLPPInterface_Expecter) WriteFailsafeProductionActivePowerLimit(entity interface{}, value interface{}) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { return &EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call{Call: _e.mock.On("WriteFailsafeProductionActivePowerLimit", entity, value)} } -func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, value float64)) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { +func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) Run(run func(entity api.EntityRemoteInterface, value float64)) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(float64)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 float64 + if args[1] != nil { + arg1 = args[1].(float64) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, float64) (*model.MsgCounterType, error)) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { +func (_c *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, value float64) (*model.MsgCounterType, error)) *EgLPPInterface_WriteFailsafeProductionActivePowerLimit_Call { _c.Call.Return(run) return _c } -// WriteProductionLimit provides a mock function with given fields: entity, limit, resultCB -func (_m *EgLPPInterface) WriteProductionLimit(entity spine_goapi.EntityRemoteInterface, limit api.LoadLimit, resultCB func(model.ResultDataType)) (*model.MsgCounterType, error) { - ret := _m.Called(entity, limit, resultCB) +// WriteProductionLimit provides a mock function for the type EgLPPInterface +func (_mock *EgLPPInterface) WriteProductionLimit(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error) { + ret := _mock.Called(entity, limit, resultCB) if len(ret) == 0 { panic("no return value specified for WriteProductionLimit") @@ -820,23 +901,21 @@ func (_m *EgLPPInterface) WriteProductionLimit(entity spine_goapi.EntityRemoteIn var r0 *model.MsgCounterType var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) (*model.MsgCounterType, error)); ok { - return rf(entity, limit, resultCB) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) (*model.MsgCounterType, error)); ok { + return returnFunc(entity, limit, resultCB) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) *model.MsgCounterType); ok { - r0 = rf(entity, limit, resultCB) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) *model.MsgCounterType); ok { + r0 = returnFunc(entity, limit, resultCB) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.MsgCounterType) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) error); ok { - r1 = rf(entity, limit, resultCB) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface, api0.LoadLimit, func(result model.ResultDataType)) error); ok { + r1 = returnFunc(entity, limit, resultCB) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -846,40 +925,42 @@ type EgLPPInterface_WriteProductionLimit_Call struct { } // WriteProductionLimit is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -// - limit api.LoadLimit -// - resultCB func(model.ResultDataType) +// - entity api.EntityRemoteInterface +// - limit api0.LoadLimit +// - resultCB func(result model.ResultDataType) func (_e *EgLPPInterface_Expecter) WriteProductionLimit(entity interface{}, limit interface{}, resultCB interface{}) *EgLPPInterface_WriteProductionLimit_Call { return &EgLPPInterface_WriteProductionLimit_Call{Call: _e.mock.On("WriteProductionLimit", entity, limit, resultCB)} } -func (_c *EgLPPInterface_WriteProductionLimit_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, limit api.LoadLimit, resultCB func(model.ResultDataType))) *EgLPPInterface_WriteProductionLimit_Call { +func (_c *EgLPPInterface_WriteProductionLimit_Call) Run(run func(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType))) *EgLPPInterface_WriteProductionLimit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(api.LoadLimit), args[2].(func(model.ResultDataType))) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 api0.LoadLimit + if args[1] != nil { + arg1 = args[1].(api0.LoadLimit) + } + var arg2 func(result model.ResultDataType) + if args[2] != nil { + arg2 = args[2].(func(result model.ResultDataType)) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *EgLPPInterface_WriteProductionLimit_Call) Return(_a0 *model.MsgCounterType, _a1 error) *EgLPPInterface_WriteProductionLimit_Call { - _c.Call.Return(_a0, _a1) +func (_c *EgLPPInterface_WriteProductionLimit_Call) Return(msgCounterType *model.MsgCounterType, err error) *EgLPPInterface_WriteProductionLimit_Call { + _c.Call.Return(msgCounterType, err) return _c } -func (_c *EgLPPInterface_WriteProductionLimit_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, api.LoadLimit, func(model.ResultDataType)) (*model.MsgCounterType, error)) *EgLPPInterface_WriteProductionLimit_Call { +func (_c *EgLPPInterface_WriteProductionLimit_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, limit api0.LoadLimit, resultCB func(result model.ResultDataType)) (*model.MsgCounterType, error)) *EgLPPInterface_WriteProductionLimit_Call { _c.Call.Return(run) return _c } - -// NewEgLPPInterface creates a new instance of EgLPPInterface. 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 NewEgLPPInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *EgLPPInterface { - mock := &EgLPPInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/GcpMGCPInterface.go b/usecases/mocks/GcpMGCPInterface.go index 12fb206f..6a92caab 100644 --- a/usecases/mocks/GcpMGCPInterface.go +++ b/usecases/mocks/GcpMGCPInterface.go @@ -1,14 +1,33 @@ -// Code generated by mockery v2.42.1. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" - mock "github.com/stretchr/testify/mock" + "time" - spine_goapi "github.com/enbility/spine-go/api" + api0 "github.com/enbility/eebus-go/api" + api1 "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" + mock "github.com/stretchr/testify/mock" ) +// NewGcpMGCPInterface creates a new instance of GcpMGCPInterface. 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 NewGcpMGCPInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *GcpMGCPInterface { + mock := &GcpMGCPInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // GcpMGCPInterface is an autogenerated mock type for the GcpMGCPInterface type type GcpMGCPInterface struct { mock.Mock @@ -22,9 +41,21 @@ func (_m *GcpMGCPInterface) EXPECT() *GcpMGCPInterface_Expecter { return &GcpMGCPInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with given fields: -func (_m *GcpMGCPInterface) AddFeatures() { - _m.Called() +// AddFeatures provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) AddFeatures() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for AddFeatures") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 } // GcpMGCPInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures' @@ -44,19 +75,20 @@ func (_c *GcpMGCPInterface_AddFeatures_Call) Run(run func()) *GcpMGCPInterface_A return _c } -func (_c *GcpMGCPInterface_AddFeatures_Call) Return() *GcpMGCPInterface_AddFeatures_Call { - _c.Call.Return() +func (_c *GcpMGCPInterface_AddFeatures_Call) Return(err error) *GcpMGCPInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } -func (_c *GcpMGCPInterface_AddFeatures_Call) RunAndReturn(run func()) *GcpMGCPInterface_AddFeatures_Call { +func (_c *GcpMGCPInterface_AddFeatures_Call) RunAndReturn(run func() error) *GcpMGCPInterface_AddFeatures_Call { _c.Call.Return(run) return _c } -// AddUseCase provides a mock function with given fields: -func (_m *GcpMGCPInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) AddUseCase() { + _mock.Called() + return } // GcpMGCPInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -82,27 +114,26 @@ func (_c *GcpMGCPInterface_AddUseCase_Call) Return() *GcpMGCPInterface_AddUseCas } func (_c *GcpMGCPInterface_AddUseCase_Call) RunAndReturn(run func()) *GcpMGCPInterface_AddUseCase_Call { - _c.Call.Return(run) + _c.Run(run) return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *GcpMGCPInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -112,31 +143,37 @@ type GcpMGCPInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *GcpMGCPInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *GcpMGCPInterface_AvailableScenariosForEntity_Call { return &GcpMGCPInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *GcpMGCPInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *GcpMGCPInterface_AvailableScenariosForEntity_Call { +func (_c *GcpMGCPInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *GcpMGCPInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *GcpMGCPInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *GcpMGCPInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *GcpMGCPInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *GcpMGCPInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *GcpMGCPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *GcpMGCPInterface_AvailableScenariosForEntity_Call { +func (_c *GcpMGCPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *GcpMGCPInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentPerPhase provides a mock function with given fields: entity -func (_m *GcpMGCPInterface) CurrentPerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { - ret := _m.Called(entity) +// CurrentPerPhase provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) CurrentPerPhase() ([]float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for CurrentPerPhase") @@ -144,23 +181,21 @@ func (_m *GcpMGCPInterface) CurrentPerPhase(entity spine_goapi.EntityRemoteInter var r0 []float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func() ([]float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func() []float64); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -170,31 +205,30 @@ type GcpMGCPInterface_CurrentPerPhase_Call struct { } // CurrentPerPhase is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -func (_e *GcpMGCPInterface_Expecter) CurrentPerPhase(entity interface{}) *GcpMGCPInterface_CurrentPerPhase_Call { - return &GcpMGCPInterface_CurrentPerPhase_Call{Call: _e.mock.On("CurrentPerPhase", entity)} +func (_e *GcpMGCPInterface_Expecter) CurrentPerPhase() *GcpMGCPInterface_CurrentPerPhase_Call { + return &GcpMGCPInterface_CurrentPerPhase_Call{Call: _e.mock.On("CurrentPerPhase")} } -func (_c *GcpMGCPInterface_CurrentPerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *GcpMGCPInterface_CurrentPerPhase_Call { +func (_c *GcpMGCPInterface_CurrentPerPhase_Call) Run(run func()) *GcpMGCPInterface_CurrentPerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + run() }) return _c } -func (_c *GcpMGCPInterface_CurrentPerPhase_Call) Return(_a0 []float64, _a1 error) *GcpMGCPInterface_CurrentPerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *GcpMGCPInterface_CurrentPerPhase_Call) Return(float64s []float64, err error) *GcpMGCPInterface_CurrentPerPhase_Call { + _c.Call.Return(float64s, err) return _c } -func (_c *GcpMGCPInterface_CurrentPerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *GcpMGCPInterface_CurrentPerPhase_Call { +func (_c *GcpMGCPInterface_CurrentPerPhase_Call) RunAndReturn(run func() ([]float64, error)) *GcpMGCPInterface_CurrentPerPhase_Call { _c.Call.Return(run) return _c } -// EnergyConsumed provides a mock function with given fields: entity -func (_m *GcpMGCPInterface) EnergyConsumed(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// EnergyConsumed provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) EnergyConsumed() (float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for EnergyConsumed") @@ -202,21 +236,19 @@ func (_m *GcpMGCPInterface) EnergyConsumed(entity spine_goapi.EntityRemoteInterf var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -226,31 +258,30 @@ type GcpMGCPInterface_EnergyConsumed_Call struct { } // EnergyConsumed is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -func (_e *GcpMGCPInterface_Expecter) EnergyConsumed(entity interface{}) *GcpMGCPInterface_EnergyConsumed_Call { - return &GcpMGCPInterface_EnergyConsumed_Call{Call: _e.mock.On("EnergyConsumed", entity)} +func (_e *GcpMGCPInterface_Expecter) EnergyConsumed() *GcpMGCPInterface_EnergyConsumed_Call { + return &GcpMGCPInterface_EnergyConsumed_Call{Call: _e.mock.On("EnergyConsumed")} } -func (_c *GcpMGCPInterface_EnergyConsumed_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *GcpMGCPInterface_EnergyConsumed_Call { +func (_c *GcpMGCPInterface_EnergyConsumed_Call) Run(run func()) *GcpMGCPInterface_EnergyConsumed_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + run() }) return _c } -func (_c *GcpMGCPInterface_EnergyConsumed_Call) Return(_a0 float64, _a1 error) *GcpMGCPInterface_EnergyConsumed_Call { - _c.Call.Return(_a0, _a1) +func (_c *GcpMGCPInterface_EnergyConsumed_Call) Return(f float64, err error) *GcpMGCPInterface_EnergyConsumed_Call { + _c.Call.Return(f, err) return _c } -func (_c *GcpMGCPInterface_EnergyConsumed_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *GcpMGCPInterface_EnergyConsumed_Call { +func (_c *GcpMGCPInterface_EnergyConsumed_Call) RunAndReturn(run func() (float64, error)) *GcpMGCPInterface_EnergyConsumed_Call { _c.Call.Return(run) return _c } -// EnergyFeedIn provides a mock function with given fields: entity -func (_m *GcpMGCPInterface) EnergyFeedIn(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// EnergyFeedIn provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) EnergyFeedIn() (float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for EnergyFeedIn") @@ -258,21 +289,19 @@ func (_m *GcpMGCPInterface) EnergyFeedIn(entity spine_goapi.EntityRemoteInterfac var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -282,31 +311,30 @@ type GcpMGCPInterface_EnergyFeedIn_Call struct { } // EnergyFeedIn is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -func (_e *GcpMGCPInterface_Expecter) EnergyFeedIn(entity interface{}) *GcpMGCPInterface_EnergyFeedIn_Call { - return &GcpMGCPInterface_EnergyFeedIn_Call{Call: _e.mock.On("EnergyFeedIn", entity)} +func (_e *GcpMGCPInterface_Expecter) EnergyFeedIn() *GcpMGCPInterface_EnergyFeedIn_Call { + return &GcpMGCPInterface_EnergyFeedIn_Call{Call: _e.mock.On("EnergyFeedIn")} } -func (_c *GcpMGCPInterface_EnergyFeedIn_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *GcpMGCPInterface_EnergyFeedIn_Call { +func (_c *GcpMGCPInterface_EnergyFeedIn_Call) Run(run func()) *GcpMGCPInterface_EnergyFeedIn_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + run() }) return _c } -func (_c *GcpMGCPInterface_EnergyFeedIn_Call) Return(_a0 float64, _a1 error) *GcpMGCPInterface_EnergyFeedIn_Call { - _c.Call.Return(_a0, _a1) +func (_c *GcpMGCPInterface_EnergyFeedIn_Call) Return(f float64, err error) *GcpMGCPInterface_EnergyFeedIn_Call { + _c.Call.Return(f, err) return _c } -func (_c *GcpMGCPInterface_EnergyFeedIn_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *GcpMGCPInterface_EnergyFeedIn_Call { +func (_c *GcpMGCPInterface_EnergyFeedIn_Call) RunAndReturn(run func() (float64, error)) *GcpMGCPInterface_EnergyFeedIn_Call { _c.Call.Return(run) return _c } -// Frequency provides a mock function with given fields: entity -func (_m *GcpMGCPInterface) Frequency(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// Frequency provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) Frequency() (float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Frequency") @@ -314,21 +342,19 @@ func (_m *GcpMGCPInterface) Frequency(entity spine_goapi.EntityRemoteInterface) var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -338,43 +364,41 @@ type GcpMGCPInterface_Frequency_Call struct { } // Frequency is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -func (_e *GcpMGCPInterface_Expecter) Frequency(entity interface{}) *GcpMGCPInterface_Frequency_Call { - return &GcpMGCPInterface_Frequency_Call{Call: _e.mock.On("Frequency", entity)} +func (_e *GcpMGCPInterface_Expecter) Frequency() *GcpMGCPInterface_Frequency_Call { + return &GcpMGCPInterface_Frequency_Call{Call: _e.mock.On("Frequency")} } -func (_c *GcpMGCPInterface_Frequency_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *GcpMGCPInterface_Frequency_Call { +func (_c *GcpMGCPInterface_Frequency_Call) Run(run func()) *GcpMGCPInterface_Frequency_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + run() }) return _c } -func (_c *GcpMGCPInterface_Frequency_Call) Return(_a0 float64, _a1 error) *GcpMGCPInterface_Frequency_Call { - _c.Call.Return(_a0, _a1) +func (_c *GcpMGCPInterface_Frequency_Call) Return(f float64, err error) *GcpMGCPInterface_Frequency_Call { + _c.Call.Return(f, err) return _c } -func (_c *GcpMGCPInterface_Frequency_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *GcpMGCPInterface_Frequency_Call { +func (_c *GcpMGCPInterface_Frequency_Call) RunAndReturn(run func() (float64, error)) *GcpMGCPInterface_Frequency_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *GcpMGCPInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -384,43 +408,48 @@ type GcpMGCPInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *GcpMGCPInterface_Expecter) IsCompatibleEntityType(entity interface{}) *GcpMGCPInterface_IsCompatibleEntityType_Call { return &GcpMGCPInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *GcpMGCPInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *GcpMGCPInterface_IsCompatibleEntityType_Call { +func (_c *GcpMGCPInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *GcpMGCPInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *GcpMGCPInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *GcpMGCPInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *GcpMGCPInterface_IsCompatibleEntityType_Call) Return(b bool) *GcpMGCPInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *GcpMGCPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *GcpMGCPInterface_IsCompatibleEntityType_Call { +func (_c *GcpMGCPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *GcpMGCPInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *GcpMGCPInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -430,158 +459,162 @@ type GcpMGCPInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *GcpMGCPInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call { return &GcpMGCPInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *GcpMGCPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// Power provides a mock function with given fields: entity -func (_m *GcpMGCPInterface) Power(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// PowerLimitationFactor provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) PowerLimitationFactor() (float64, error) { + ret := _mock.Called() if len(ret) == 0 { - panic("no return value specified for Power") + panic("no return value specified for PowerLimitationFactor") } var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } -// GcpMGCPInterface_Power_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Power' -type GcpMGCPInterface_Power_Call struct { +// GcpMGCPInterface_PowerLimitationFactor_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PowerLimitationFactor' +type GcpMGCPInterface_PowerLimitationFactor_Call struct { *mock.Call } -// Power is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -func (_e *GcpMGCPInterface_Expecter) Power(entity interface{}) *GcpMGCPInterface_Power_Call { - return &GcpMGCPInterface_Power_Call{Call: _e.mock.On("Power", entity)} +// PowerLimitationFactor is a helper method to define mock.On call +func (_e *GcpMGCPInterface_Expecter) PowerLimitationFactor() *GcpMGCPInterface_PowerLimitationFactor_Call { + return &GcpMGCPInterface_PowerLimitationFactor_Call{Call: _e.mock.On("PowerLimitationFactor")} } -func (_c *GcpMGCPInterface_Power_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *GcpMGCPInterface_Power_Call { +func (_c *GcpMGCPInterface_PowerLimitationFactor_Call) Run(run func()) *GcpMGCPInterface_PowerLimitationFactor_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + run() }) return _c } -func (_c *GcpMGCPInterface_Power_Call) Return(_a0 float64, _a1 error) *GcpMGCPInterface_Power_Call { - _c.Call.Return(_a0, _a1) +func (_c *GcpMGCPInterface_PowerLimitationFactor_Call) Return(f float64, err error) *GcpMGCPInterface_PowerLimitationFactor_Call { + _c.Call.Return(f, err) return _c } -func (_c *GcpMGCPInterface_Power_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *GcpMGCPInterface_Power_Call { +func (_c *GcpMGCPInterface_PowerLimitationFactor_Call) RunAndReturn(run func() (float64, error)) *GcpMGCPInterface_PowerLimitationFactor_Call { _c.Call.Return(run) return _c } -// PowerLimitationFactor provides a mock function with given fields: entity -func (_m *GcpMGCPInterface) PowerLimitationFactor(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// PowerTotal provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) PowerTotal() (float64, error) { + ret := _mock.Called() if len(ret) == 0 { - panic("no return value specified for PowerLimitationFactor") + panic("no return value specified for PowerTotal") } var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } -// GcpMGCPInterface_PowerLimitationFactor_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PowerLimitationFactor' -type GcpMGCPInterface_PowerLimitationFactor_Call struct { +// GcpMGCPInterface_PowerTotal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PowerTotal' +type GcpMGCPInterface_PowerTotal_Call struct { *mock.Call } -// PowerLimitationFactor is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -func (_e *GcpMGCPInterface_Expecter) PowerLimitationFactor(entity interface{}) *GcpMGCPInterface_PowerLimitationFactor_Call { - return &GcpMGCPInterface_PowerLimitationFactor_Call{Call: _e.mock.On("PowerLimitationFactor", entity)} +// PowerTotal is a helper method to define mock.On call +func (_e *GcpMGCPInterface_Expecter) PowerTotal() *GcpMGCPInterface_PowerTotal_Call { + return &GcpMGCPInterface_PowerTotal_Call{Call: _e.mock.On("PowerTotal")} } -func (_c *GcpMGCPInterface_PowerLimitationFactor_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *GcpMGCPInterface_PowerLimitationFactor_Call { +func (_c *GcpMGCPInterface_PowerTotal_Call) Run(run func()) *GcpMGCPInterface_PowerTotal_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + run() }) return _c } -func (_c *GcpMGCPInterface_PowerLimitationFactor_Call) Return(_a0 float64, _a1 error) *GcpMGCPInterface_PowerLimitationFactor_Call { - _c.Call.Return(_a0, _a1) +func (_c *GcpMGCPInterface_PowerTotal_Call) Return(f float64, err error) *GcpMGCPInterface_PowerTotal_Call { + _c.Call.Return(f, err) return _c } -func (_c *GcpMGCPInterface_PowerLimitationFactor_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *GcpMGCPInterface_PowerLimitationFactor_Call { +func (_c *GcpMGCPInterface_PowerTotal_Call) RunAndReturn(run func() (float64, error)) *GcpMGCPInterface_PowerTotal_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with given fields: -func (_m *GcpMGCPInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api0.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api0.RemoteEntityScenarios) } } - return r0 } @@ -602,19 +635,20 @@ func (_c *GcpMGCPInterface_RemoteEntitiesScenarios_Call) Run(run func()) *GcpMGC return _c } -func (_c *GcpMGCPInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *GcpMGCPInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *GcpMGCPInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *GcpMGCPInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *GcpMGCPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *GcpMGCPInterface_RemoteEntitiesScenarios_Call { +func (_c *GcpMGCPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *GcpMGCPInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with given fields: -func (_m *GcpMGCPInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) RemoveUseCase() { + _mock.Called() + return } // GcpMGCPInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -640,111 +674,1083 @@ func (_c *GcpMGCPInterface_RemoveUseCase_Call) Return() *GcpMGCPInterface_Remove } func (_c *GcpMGCPInterface_RemoveUseCase_Call) RunAndReturn(run func()) *GcpMGCPInterface_RemoveUseCase_Call { + _c.Run(run) + return _c +} + +// Update provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) Update(updateValueTypes ...api1.UpdateData) error { + var tmpRet mock.Arguments + if len(updateValueTypes) > 0 { + tmpRet = _mock.Called(updateValueTypes) + } else { + tmpRet = _mock.Called() + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(...api1.UpdateData) error); ok { + r0 = returnFunc(updateValueTypes...) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// GcpMGCPInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type GcpMGCPInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - updateValueTypes ...api1.UpdateData +func (_e *GcpMGCPInterface_Expecter) Update(updateValueTypes ...interface{}) *GcpMGCPInterface_Update_Call { + return &GcpMGCPInterface_Update_Call{Call: _e.mock.On("Update", + append([]interface{}{}, updateValueTypes...)...)} +} + +func (_c *GcpMGCPInterface_Update_Call) Run(run func(updateValueTypes ...api1.UpdateData)) *GcpMGCPInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 []api1.UpdateData + var variadicArgs []api1.UpdateData + if len(args) > 0 { + variadicArgs = args[0].([]api1.UpdateData) + } + arg0 = variadicArgs + run( + arg0..., + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_Update_Call) Return(err error) *GcpMGCPInterface_Update_Call { + _c.Call.Return(err) + return _c +} + +func (_c *GcpMGCPInterface_Update_Call) RunAndReturn(run func(updateValueTypes ...api1.UpdateData) error) *GcpMGCPInterface_Update_Call { _c.Call.Return(run) return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *GcpMGCPInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateDataCurrentPhaseA provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataCurrentPhaseA") + } + + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 } -// GcpMGCPInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' -type GcpMGCPInterface_UpdateUseCaseAvailability_Call struct { +// GcpMGCPInterface_UpdateDataCurrentPhaseA_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataCurrentPhaseA' +type GcpMGCPInterface_UpdateDataCurrentPhaseA_Call struct { *mock.Call } -// UpdateUseCaseAvailability is a helper method to define mock.On call -// - available bool -func (_e *GcpMGCPInterface_Expecter) UpdateUseCaseAvailability(available interface{}) *GcpMGCPInterface_UpdateUseCaseAvailability_Call { - return &GcpMGCPInterface_UpdateUseCaseAvailability_Call{Call: _e.mock.On("UpdateUseCaseAvailability", available)} +// UpdateDataCurrentPhaseA is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *GcpMGCPInterface_Expecter) UpdateDataCurrentPhaseA(value interface{}, timestamp interface{}, valueState interface{}) *GcpMGCPInterface_UpdateDataCurrentPhaseA_Call { + return &GcpMGCPInterface_UpdateDataCurrentPhaseA_Call{Call: _e.mock.On("UpdateDataCurrentPhaseA", value, timestamp, valueState)} } -func (_c *GcpMGCPInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *GcpMGCPInterface_UpdateUseCaseAvailability_Call { +func (_c *GcpMGCPInterface_UpdateDataCurrentPhaseA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *GcpMGCPInterface_UpdateDataCurrentPhaseA_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *GcpMGCPInterface_UpdateUseCaseAvailability_Call) Return() *GcpMGCPInterface_UpdateUseCaseAvailability_Call { - _c.Call.Return() +func (_c *GcpMGCPInterface_UpdateDataCurrentPhaseA_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataCurrentPhaseA_Call { + _c.Call.Return(updateData) return _c } -func (_c *GcpMGCPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *GcpMGCPInterface_UpdateUseCaseAvailability_Call { +func (_c *GcpMGCPInterface_UpdateDataCurrentPhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData) *GcpMGCPInterface_UpdateDataCurrentPhaseA_Call { _c.Call.Return(run) return _c } -// VoltagePerPhase provides a mock function with given fields: entity -func (_m *GcpMGCPInterface) VoltagePerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { - ret := _m.Called(entity) +// UpdateDataCurrentPhaseB provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { - panic("no return value specified for VoltagePerPhase") + panic("no return value specified for UpdateDataCurrentPhaseB") } - var r0 []float64 - var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { - return rf(entity) + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataCurrentPhaseB_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataCurrentPhaseB' +type GcpMGCPInterface_UpdateDataCurrentPhaseB_Call struct { + *mock.Call +} + +// UpdateDataCurrentPhaseB is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *GcpMGCPInterface_Expecter) UpdateDataCurrentPhaseB(value interface{}, timestamp interface{}, valueState interface{}) *GcpMGCPInterface_UpdateDataCurrentPhaseB_Call { + return &GcpMGCPInterface_UpdateDataCurrentPhaseB_Call{Call: _e.mock.On("UpdateDataCurrentPhaseB", value, timestamp, valueState)} +} + +func (_c *GcpMGCPInterface_UpdateDataCurrentPhaseB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *GcpMGCPInterface_UpdateDataCurrentPhaseB_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataCurrentPhaseB_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataCurrentPhaseB_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataCurrentPhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData) *GcpMGCPInterface_UpdateDataCurrentPhaseB_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataCurrentPhaseC provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataCurrentPhaseC") } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r0 = rf(entity) + + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]float64) + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataCurrentPhaseC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataCurrentPhaseC' +type GcpMGCPInterface_UpdateDataCurrentPhaseC_Call struct { + *mock.Call +} + +// UpdateDataCurrentPhaseC is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *GcpMGCPInterface_Expecter) UpdateDataCurrentPhaseC(value interface{}, timestamp interface{}, valueState interface{}) *GcpMGCPInterface_UpdateDataCurrentPhaseC_Call { + return &GcpMGCPInterface_UpdateDataCurrentPhaseC_Call{Call: _e.mock.On("UpdateDataCurrentPhaseC", value, timestamp, valueState)} +} + +func (_c *GcpMGCPInterface_UpdateDataCurrentPhaseC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *GcpMGCPInterface_UpdateDataCurrentPhaseC_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataCurrentPhaseC_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataCurrentPhaseC_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataCurrentPhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData) *GcpMGCPInterface_UpdateDataCurrentPhaseC_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataEnergyConsumed provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataEnergyConsumed(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState, evaluationPeriodStart, evaluationPeriodEnd) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataEnergyConsumed") } - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState, evaluationPeriodStart, evaluationPeriodEnd) } else { - r1 = ret.Error(1) + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } } + return r0 +} - return r0, r1 +// GcpMGCPInterface_UpdateDataEnergyConsumed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataEnergyConsumed' +type GcpMGCPInterface_UpdateDataEnergyConsumed_Call struct { + *mock.Call } -// GcpMGCPInterface_VoltagePerPhase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VoltagePerPhase' -type GcpMGCPInterface_VoltagePerPhase_Call struct { +// UpdateDataEnergyConsumed is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +// - evaluationPeriodStart *time.Time +// - evaluationPeriodEnd *time.Time +func (_e *GcpMGCPInterface_Expecter) UpdateDataEnergyConsumed(value interface{}, timestamp interface{}, valueState interface{}, evaluationPeriodStart interface{}, evaluationPeriodEnd interface{}) *GcpMGCPInterface_UpdateDataEnergyConsumed_Call { + return &GcpMGCPInterface_UpdateDataEnergyConsumed_Call{Call: _e.mock.On("UpdateDataEnergyConsumed", value, timestamp, valueState, evaluationPeriodStart, evaluationPeriodEnd)} +} + +func (_c *GcpMGCPInterface_UpdateDataEnergyConsumed_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time)) *GcpMGCPInterface_UpdateDataEnergyConsumed_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + var arg3 *time.Time + if args[3] != nil { + arg3 = args[3].(*time.Time) + } + var arg4 *time.Time + if args[4] != nil { + arg4 = args[4].(*time.Time) + } + run( + arg0, + arg1, + arg2, + arg3, + arg4, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataEnergyConsumed_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataEnergyConsumed_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataEnergyConsumed_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time) api1.UpdateData) *GcpMGCPInterface_UpdateDataEnergyConsumed_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataEnergyFeedIn provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataEnergyFeedIn(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState, evaluationPeriodStart, evaluationPeriodEnd) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataEnergyFeedIn") + } + + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState, evaluationPeriodStart, evaluationPeriodEnd) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataEnergyFeedIn_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataEnergyFeedIn' +type GcpMGCPInterface_UpdateDataEnergyFeedIn_Call struct { *mock.Call } -// VoltagePerPhase is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface -func (_e *GcpMGCPInterface_Expecter) VoltagePerPhase(entity interface{}) *GcpMGCPInterface_VoltagePerPhase_Call { - return &GcpMGCPInterface_VoltagePerPhase_Call{Call: _e.mock.On("VoltagePerPhase", entity)} +// UpdateDataEnergyFeedIn is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +// - evaluationPeriodStart *time.Time +// - evaluationPeriodEnd *time.Time +func (_e *GcpMGCPInterface_Expecter) UpdateDataEnergyFeedIn(value interface{}, timestamp interface{}, valueState interface{}, evaluationPeriodStart interface{}, evaluationPeriodEnd interface{}) *GcpMGCPInterface_UpdateDataEnergyFeedIn_Call { + return &GcpMGCPInterface_UpdateDataEnergyFeedIn_Call{Call: _e.mock.On("UpdateDataEnergyFeedIn", value, timestamp, valueState, evaluationPeriodStart, evaluationPeriodEnd)} } -func (_c *GcpMGCPInterface_VoltagePerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *GcpMGCPInterface_VoltagePerPhase_Call { +func (_c *GcpMGCPInterface_UpdateDataEnergyFeedIn_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time)) *GcpMGCPInterface_UpdateDataEnergyFeedIn_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + var arg3 *time.Time + if args[3] != nil { + arg3 = args[3].(*time.Time) + } + var arg4 *time.Time + if args[4] != nil { + arg4 = args[4].(*time.Time) + } + run( + arg0, + arg1, + arg2, + arg3, + arg4, + ) }) return _c } -func (_c *GcpMGCPInterface_VoltagePerPhase_Call) Return(_a0 []float64, _a1 error) *GcpMGCPInterface_VoltagePerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *GcpMGCPInterface_UpdateDataEnergyFeedIn_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataEnergyFeedIn_Call { + _c.Call.Return(updateData) return _c } -func (_c *GcpMGCPInterface_VoltagePerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *GcpMGCPInterface_VoltagePerPhase_Call { +func (_c *GcpMGCPInterface_UpdateDataEnergyFeedIn_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationPeriodStart *time.Time, evaluationPeriodEnd *time.Time) api1.UpdateData) *GcpMGCPInterface_UpdateDataEnergyFeedIn_Call { _c.Call.Return(run) return _c } -// NewGcpMGCPInterface creates a new instance of GcpMGCPInterface. 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 NewGcpMGCPInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *GcpMGCPInterface { - mock := &GcpMGCPInterface{} - mock.Mock.Test(t) +// UpdateDataFrequency provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState) - t.Cleanup(func() { mock.AssertExpectations(t) }) + if len(ret) == 0 { + panic("no return value specified for UpdateDataFrequency") + } - return mock + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataFrequency_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataFrequency' +type GcpMGCPInterface_UpdateDataFrequency_Call struct { + *mock.Call +} + +// UpdateDataFrequency is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *GcpMGCPInterface_Expecter) UpdateDataFrequency(value interface{}, timestamp interface{}, valueState interface{}) *GcpMGCPInterface_UpdateDataFrequency_Call { + return &GcpMGCPInterface_UpdateDataFrequency_Call{Call: _e.mock.On("UpdateDataFrequency", value, timestamp, valueState)} +} + +func (_c *GcpMGCPInterface_UpdateDataFrequency_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *GcpMGCPInterface_UpdateDataFrequency_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataFrequency_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataFrequency_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataFrequency_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData) *GcpMGCPInterface_UpdateDataFrequency_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataPowerLimitationFactor provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataPowerLimitationFactor(value float64) api1.UpdateData { + ret := _mock.Called(value) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataPowerLimitationFactor") + } + + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64) api1.UpdateData); ok { + r0 = returnFunc(value) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataPowerLimitationFactor_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataPowerLimitationFactor' +type GcpMGCPInterface_UpdateDataPowerLimitationFactor_Call struct { + *mock.Call +} + +// UpdateDataPowerLimitationFactor is a helper method to define mock.On call +// - value float64 +func (_e *GcpMGCPInterface_Expecter) UpdateDataPowerLimitationFactor(value interface{}) *GcpMGCPInterface_UpdateDataPowerLimitationFactor_Call { + return &GcpMGCPInterface_UpdateDataPowerLimitationFactor_Call{Call: _e.mock.On("UpdateDataPowerLimitationFactor", value)} +} + +func (_c *GcpMGCPInterface_UpdateDataPowerLimitationFactor_Call) Run(run func(value float64)) *GcpMGCPInterface_UpdateDataPowerLimitationFactor_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataPowerLimitationFactor_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataPowerLimitationFactor_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataPowerLimitationFactor_Call) RunAndReturn(run func(value float64) api1.UpdateData) *GcpMGCPInterface_UpdateDataPowerLimitationFactor_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataPowerTotal provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataPowerTotal") + } + + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataPowerTotal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataPowerTotal' +type GcpMGCPInterface_UpdateDataPowerTotal_Call struct { + *mock.Call +} + +// UpdateDataPowerTotal is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *GcpMGCPInterface_Expecter) UpdateDataPowerTotal(value interface{}, timestamp interface{}, valueState interface{}) *GcpMGCPInterface_UpdateDataPowerTotal_Call { + return &GcpMGCPInterface_UpdateDataPowerTotal_Call{Call: _e.mock.On("UpdateDataPowerTotal", value, timestamp, valueState)} +} + +func (_c *GcpMGCPInterface_UpdateDataPowerTotal_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *GcpMGCPInterface_UpdateDataPowerTotal_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataPowerTotal_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataPowerTotal_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataPowerTotal_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData) *GcpMGCPInterface_UpdateDataPowerTotal_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseA provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseA") + } + + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataVoltagePhaseA_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseA' +type GcpMGCPInterface_UpdateDataVoltagePhaseA_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseA is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *GcpMGCPInterface_Expecter) UpdateDataVoltagePhaseA(value interface{}, timestamp interface{}, valueState interface{}) *GcpMGCPInterface_UpdateDataVoltagePhaseA_Call { + return &GcpMGCPInterface_UpdateDataVoltagePhaseA_Call{Call: _e.mock.On("UpdateDataVoltagePhaseA", value, timestamp, valueState)} +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *GcpMGCPInterface_UpdateDataVoltagePhaseA_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseA_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseA_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseA_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseAToB provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseAToB") + } + + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataVoltagePhaseAToB_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseAToB' +type GcpMGCPInterface_UpdateDataVoltagePhaseAToB_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseAToB is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *GcpMGCPInterface_Expecter) UpdateDataVoltagePhaseAToB(value interface{}, timestamp interface{}, valueState interface{}) *GcpMGCPInterface_UpdateDataVoltagePhaseAToB_Call { + return &GcpMGCPInterface_UpdateDataVoltagePhaseAToB_Call{Call: _e.mock.On("UpdateDataVoltagePhaseAToB", value, timestamp, valueState)} +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseAToB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *GcpMGCPInterface_UpdateDataVoltagePhaseAToB_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseAToB_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseAToB_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseAToB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseAToB_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseB provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseB") + } + + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataVoltagePhaseB_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseB' +type GcpMGCPInterface_UpdateDataVoltagePhaseB_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseB is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *GcpMGCPInterface_Expecter) UpdateDataVoltagePhaseB(value interface{}, timestamp interface{}, valueState interface{}) *GcpMGCPInterface_UpdateDataVoltagePhaseB_Call { + return &GcpMGCPInterface_UpdateDataVoltagePhaseB_Call{Call: _e.mock.On("UpdateDataVoltagePhaseB", value, timestamp, valueState)} +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *GcpMGCPInterface_UpdateDataVoltagePhaseB_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseB_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseB_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseB_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseBToC provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseBToC") + } + + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataVoltagePhaseBToC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseBToC' +type GcpMGCPInterface_UpdateDataVoltagePhaseBToC_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseBToC is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *GcpMGCPInterface_Expecter) UpdateDataVoltagePhaseBToC(value interface{}, timestamp interface{}, valueState interface{}) *GcpMGCPInterface_UpdateDataVoltagePhaseBToC_Call { + return &GcpMGCPInterface_UpdateDataVoltagePhaseBToC_Call{Call: _e.mock.On("UpdateDataVoltagePhaseBToC", value, timestamp, valueState)} +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseBToC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *GcpMGCPInterface_UpdateDataVoltagePhaseBToC_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseBToC_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseBToC_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseBToC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseBToC_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseC provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseC") + } + + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataVoltagePhaseC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseC' +type GcpMGCPInterface_UpdateDataVoltagePhaseC_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseC is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *GcpMGCPInterface_Expecter) UpdateDataVoltagePhaseC(value interface{}, timestamp interface{}, valueState interface{}) *GcpMGCPInterface_UpdateDataVoltagePhaseC_Call { + return &GcpMGCPInterface_UpdateDataVoltagePhaseC_Call{Call: _e.mock.On("UpdateDataVoltagePhaseC", value, timestamp, valueState)} +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *GcpMGCPInterface_UpdateDataVoltagePhaseC_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseC_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseC_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseC_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDataVoltagePhaseCToA provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateDataVoltagePhaseCToA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData { + ret := _mock.Called(value, timestamp, valueState) + + if len(ret) == 0 { + panic("no return value specified for UpdateDataVoltagePhaseCToA") + } + + var r0 api1.UpdateData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateData); ok { + r0 = returnFunc(value, timestamp, valueState) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api1.UpdateData) + } + } + return r0 +} + +// GcpMGCPInterface_UpdateDataVoltagePhaseCToA_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataVoltagePhaseCToA' +type GcpMGCPInterface_UpdateDataVoltagePhaseCToA_Call struct { + *mock.Call +} + +// UpdateDataVoltagePhaseCToA is a helper method to define mock.On call +// - value float64 +// - timestamp *time.Time +// - valueState *model.MeasurementValueStateType +func (_e *GcpMGCPInterface_Expecter) UpdateDataVoltagePhaseCToA(value interface{}, timestamp interface{}, valueState interface{}) *GcpMGCPInterface_UpdateDataVoltagePhaseCToA_Call { + return &GcpMGCPInterface_UpdateDataVoltagePhaseCToA_Call{Call: _e.mock.On("UpdateDataVoltagePhaseCToA", value, timestamp, valueState)} +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseCToA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *GcpMGCPInterface_UpdateDataVoltagePhaseCToA_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseCToA_Call) Return(updateData api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseCToA_Call { + _c.Call.Return(updateData) + return _c +} + +func (_c *GcpMGCPInterface_UpdateDataVoltagePhaseCToA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateData) *GcpMGCPInterface_UpdateDataVoltagePhaseCToA_Call { + _c.Call.Return(run) + return _c +} + +// UpdateUseCaseAvailability provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return +} + +// GcpMGCPInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' +type GcpMGCPInterface_UpdateUseCaseAvailability_Call struct { + *mock.Call +} + +// UpdateUseCaseAvailability is a helper method to define mock.On call +// - available bool +func (_e *GcpMGCPInterface_Expecter) UpdateUseCaseAvailability(available interface{}) *GcpMGCPInterface_UpdateUseCaseAvailability_Call { + return &GcpMGCPInterface_UpdateUseCaseAvailability_Call{Call: _e.mock.On("UpdateUseCaseAvailability", available)} +} + +func (_c *GcpMGCPInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *GcpMGCPInterface_UpdateUseCaseAvailability_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *GcpMGCPInterface_UpdateUseCaseAvailability_Call) Return() *GcpMGCPInterface_UpdateUseCaseAvailability_Call { + _c.Call.Return() + return _c +} + +func (_c *GcpMGCPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *GcpMGCPInterface_UpdateUseCaseAvailability_Call { + _c.Run(run) + return _c +} + +// VoltagePerPhase provides a mock function for the type GcpMGCPInterface +func (_mock *GcpMGCPInterface) VoltagePerPhase() ([]float64, error) { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for VoltagePerPhase") + } + + var r0 []float64 + var r1 error + if returnFunc, ok := ret.Get(0).(func() ([]float64, error)); ok { + return returnFunc() + } + if returnFunc, ok := ret.Get(0).(func() []float64); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]float64) + } + } + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// GcpMGCPInterface_VoltagePerPhase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VoltagePerPhase' +type GcpMGCPInterface_VoltagePerPhase_Call struct { + *mock.Call +} + +// VoltagePerPhase is a helper method to define mock.On call +func (_e *GcpMGCPInterface_Expecter) VoltagePerPhase() *GcpMGCPInterface_VoltagePerPhase_Call { + return &GcpMGCPInterface_VoltagePerPhase_Call{Call: _e.mock.On("VoltagePerPhase")} +} + +func (_c *GcpMGCPInterface_VoltagePerPhase_Call) Run(run func()) *GcpMGCPInterface_VoltagePerPhase_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *GcpMGCPInterface_VoltagePerPhase_Call) Return(float64s []float64, err error) *GcpMGCPInterface_VoltagePerPhase_Call { + _c.Call.Return(float64s, err) + return _c +} + +func (_c *GcpMGCPInterface_VoltagePerPhase_Call) RunAndReturn(run func() ([]float64, error)) *GcpMGCPInterface_VoltagePerPhase_Call { + _c.Call.Return(run) + return _c } diff --git a/usecases/mocks/MaMGCPInterface.go b/usecases/mocks/MaMGCPInterface.go index 0b128cfd..e2e93db1 100644 --- a/usecases/mocks/MaMGCPInterface.go +++ b/usecases/mocks/MaMGCPInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/api" mock "github.com/stretchr/testify/mock" - - spine_goapi "github.com/enbility/spine-go/api" ) +// NewMaMGCPInterface creates a new instance of MaMGCPInterface. 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 NewMaMGCPInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MaMGCPInterface { + mock := &MaMGCPInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // MaMGCPInterface is an autogenerated mock type for the MaMGCPInterface type type MaMGCPInterface struct { mock.Mock @@ -22,21 +37,20 @@ func (_m *MaMGCPInterface) EXPECT() *MaMGCPInterface_Expecter { return &MaMGCPInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *MaMGCPInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -57,8 +71,8 @@ func (_c *MaMGCPInterface_AddFeatures_Call) Run(run func()) *MaMGCPInterface_Add return _c } -func (_c *MaMGCPInterface_AddFeatures_Call) Return(_a0 error) *MaMGCPInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *MaMGCPInterface_AddFeatures_Call) Return(err error) *MaMGCPInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -67,9 +81,10 @@ func (_c *MaMGCPInterface_AddFeatures_Call) RunAndReturn(run func() error) *MaMG return _c } -// AddUseCase provides a mock function with no fields -func (_m *MaMGCPInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) AddUseCase() { + _mock.Called() + return } // MaMGCPInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -99,23 +114,22 @@ func (_c *MaMGCPInterface_AddUseCase_Call) RunAndReturn(run func()) *MaMGCPInter return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *MaMGCPInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -125,31 +139,37 @@ type MaMGCPInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *MaMGCPInterface_AvailableScenariosForEntity_Call { return &MaMGCPInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_AvailableScenariosForEntity_Call { +func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *MaMGCPInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *MaMGCPInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *MaMGCPInterface_AvailableScenariosForEntity_Call { +func (_c *MaMGCPInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *MaMGCPInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentPerPhase provides a mock function with given fields: entity -func (_m *MaMGCPInterface) CurrentPerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { - ret := _m.Called(entity) +// CurrentPerPhase provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) CurrentPerPhase(entity api.EntityRemoteInterface) ([]float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for CurrentPerPhase") @@ -157,23 +177,21 @@ func (_m *MaMGCPInterface) CurrentPerPhase(entity spine_goapi.EntityRemoteInterf var r0 []float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -183,31 +201,37 @@ type MaMGCPInterface_CurrentPerPhase_Call struct { } // CurrentPerPhase is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) CurrentPerPhase(entity interface{}) *MaMGCPInterface_CurrentPerPhase_Call { return &MaMGCPInterface_CurrentPerPhase_Call{Call: _e.mock.On("CurrentPerPhase", entity)} } -func (_c *MaMGCPInterface_CurrentPerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_CurrentPerPhase_Call { +func (_c *MaMGCPInterface_CurrentPerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_CurrentPerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMGCPInterface_CurrentPerPhase_Call) Return(_a0 []float64, _a1 error) *MaMGCPInterface_CurrentPerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMGCPInterface_CurrentPerPhase_Call) Return(float64s []float64, err error) *MaMGCPInterface_CurrentPerPhase_Call { + _c.Call.Return(float64s, err) return _c } -func (_c *MaMGCPInterface_CurrentPerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *MaMGCPInterface_CurrentPerPhase_Call { +func (_c *MaMGCPInterface_CurrentPerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *MaMGCPInterface_CurrentPerPhase_Call { _c.Call.Return(run) return _c } -// EnergyConsumed provides a mock function with given fields: entity -func (_m *MaMGCPInterface) EnergyConsumed(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// EnergyConsumed provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) EnergyConsumed(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyConsumed") @@ -215,21 +239,19 @@ func (_m *MaMGCPInterface) EnergyConsumed(entity spine_goapi.EntityRemoteInterfa var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -239,31 +261,37 @@ type MaMGCPInterface_EnergyConsumed_Call struct { } // EnergyConsumed is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) EnergyConsumed(entity interface{}) *MaMGCPInterface_EnergyConsumed_Call { return &MaMGCPInterface_EnergyConsumed_Call{Call: _e.mock.On("EnergyConsumed", entity)} } -func (_c *MaMGCPInterface_EnergyConsumed_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_EnergyConsumed_Call { +func (_c *MaMGCPInterface_EnergyConsumed_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_EnergyConsumed_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMGCPInterface_EnergyConsumed_Call) Return(_a0 float64, _a1 error) *MaMGCPInterface_EnergyConsumed_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMGCPInterface_EnergyConsumed_Call) Return(f float64, err error) *MaMGCPInterface_EnergyConsumed_Call { + _c.Call.Return(f, err) return _c } -func (_c *MaMGCPInterface_EnergyConsumed_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_EnergyConsumed_Call { +func (_c *MaMGCPInterface_EnergyConsumed_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_EnergyConsumed_Call { _c.Call.Return(run) return _c } -// EnergyFeedIn provides a mock function with given fields: entity -func (_m *MaMGCPInterface) EnergyFeedIn(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// EnergyFeedIn provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) EnergyFeedIn(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyFeedIn") @@ -271,21 +299,19 @@ func (_m *MaMGCPInterface) EnergyFeedIn(entity spine_goapi.EntityRemoteInterface var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -295,31 +321,37 @@ type MaMGCPInterface_EnergyFeedIn_Call struct { } // EnergyFeedIn is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) EnergyFeedIn(entity interface{}) *MaMGCPInterface_EnergyFeedIn_Call { return &MaMGCPInterface_EnergyFeedIn_Call{Call: _e.mock.On("EnergyFeedIn", entity)} } -func (_c *MaMGCPInterface_EnergyFeedIn_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_EnergyFeedIn_Call { +func (_c *MaMGCPInterface_EnergyFeedIn_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_EnergyFeedIn_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMGCPInterface_EnergyFeedIn_Call) Return(_a0 float64, _a1 error) *MaMGCPInterface_EnergyFeedIn_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMGCPInterface_EnergyFeedIn_Call) Return(f float64, err error) *MaMGCPInterface_EnergyFeedIn_Call { + _c.Call.Return(f, err) return _c } -func (_c *MaMGCPInterface_EnergyFeedIn_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_EnergyFeedIn_Call { +func (_c *MaMGCPInterface_EnergyFeedIn_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_EnergyFeedIn_Call { _c.Call.Return(run) return _c } -// Frequency provides a mock function with given fields: entity -func (_m *MaMGCPInterface) Frequency(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// Frequency provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) Frequency(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for Frequency") @@ -327,21 +359,19 @@ func (_m *MaMGCPInterface) Frequency(entity spine_goapi.EntityRemoteInterface) ( var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -351,43 +381,48 @@ type MaMGCPInterface_Frequency_Call struct { } // Frequency is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) Frequency(entity interface{}) *MaMGCPInterface_Frequency_Call { return &MaMGCPInterface_Frequency_Call{Call: _e.mock.On("Frequency", entity)} } -func (_c *MaMGCPInterface_Frequency_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_Frequency_Call { +func (_c *MaMGCPInterface_Frequency_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_Frequency_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMGCPInterface_Frequency_Call) Return(_a0 float64, _a1 error) *MaMGCPInterface_Frequency_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMGCPInterface_Frequency_Call) Return(f float64, err error) *MaMGCPInterface_Frequency_Call { + _c.Call.Return(f, err) return _c } -func (_c *MaMGCPInterface_Frequency_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_Frequency_Call { +func (_c *MaMGCPInterface_Frequency_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_Frequency_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *MaMGCPInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -397,43 +432,48 @@ type MaMGCPInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) IsCompatibleEntityType(entity interface{}) *MaMGCPInterface_IsCompatibleEntityType_Call { return &MaMGCPInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_IsCompatibleEntityType_Call { +func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *MaMGCPInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) Return(b bool) *MaMGCPInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *MaMGCPInterface_IsCompatibleEntityType_Call { +func (_c *MaMGCPInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *MaMGCPInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *MaMGCPInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -443,32 +483,43 @@ type MaMGCPInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *MaMGCPInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { return &MaMGCPInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { +func (_c *MaMGCPInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *MaMGCPInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// Power provides a mock function with given fields: entity -func (_m *MaMGCPInterface) Power(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// Power provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) Power(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for Power") @@ -476,21 +527,19 @@ func (_m *MaMGCPInterface) Power(entity spine_goapi.EntityRemoteInterface) (floa var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -500,31 +549,37 @@ type MaMGCPInterface_Power_Call struct { } // Power is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) Power(entity interface{}) *MaMGCPInterface_Power_Call { return &MaMGCPInterface_Power_Call{Call: _e.mock.On("Power", entity)} } -func (_c *MaMGCPInterface_Power_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_Power_Call { +func (_c *MaMGCPInterface_Power_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_Power_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMGCPInterface_Power_Call) Return(_a0 float64, _a1 error) *MaMGCPInterface_Power_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMGCPInterface_Power_Call) Return(f float64, err error) *MaMGCPInterface_Power_Call { + _c.Call.Return(f, err) return _c } -func (_c *MaMGCPInterface_Power_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_Power_Call { +func (_c *MaMGCPInterface_Power_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_Power_Call { _c.Call.Return(run) return _c } -// PowerLimitationFactor provides a mock function with given fields: entity -func (_m *MaMGCPInterface) PowerLimitationFactor(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// PowerLimitationFactor provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) PowerLimitationFactor(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for PowerLimitationFactor") @@ -532,21 +587,19 @@ func (_m *MaMGCPInterface) PowerLimitationFactor(entity spine_goapi.EntityRemote var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -556,45 +609,50 @@ type MaMGCPInterface_PowerLimitationFactor_Call struct { } // PowerLimitationFactor is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) PowerLimitationFactor(entity interface{}) *MaMGCPInterface_PowerLimitationFactor_Call { return &MaMGCPInterface_PowerLimitationFactor_Call{Call: _e.mock.On("PowerLimitationFactor", entity)} } -func (_c *MaMGCPInterface_PowerLimitationFactor_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_PowerLimitationFactor_Call { +func (_c *MaMGCPInterface_PowerLimitationFactor_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_PowerLimitationFactor_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMGCPInterface_PowerLimitationFactor_Call) Return(_a0 float64, _a1 error) *MaMGCPInterface_PowerLimitationFactor_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMGCPInterface_PowerLimitationFactor_Call) Return(f float64, err error) *MaMGCPInterface_PowerLimitationFactor_Call { + _c.Call.Return(f, err) return _c } -func (_c *MaMGCPInterface_PowerLimitationFactor_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_PowerLimitationFactor_Call { +func (_c *MaMGCPInterface_PowerLimitationFactor_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMGCPInterface_PowerLimitationFactor_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *MaMGCPInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api0.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api0.RemoteEntityScenarios) } } - return r0 } @@ -615,19 +673,20 @@ func (_c *MaMGCPInterface_RemoteEntitiesScenarios_Call) Run(run func()) *MaMGCPI return _c } -func (_c *MaMGCPInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *MaMGCPInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *MaMGCPInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *MaMGCPInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *MaMGCPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *MaMGCPInterface_RemoteEntitiesScenarios_Call { +func (_c *MaMGCPInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *MaMGCPInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *MaMGCPInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) RemoveUseCase() { + _mock.Called() + return } // MaMGCPInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -657,9 +716,10 @@ func (_c *MaMGCPInterface_RemoveUseCase_Call) RunAndReturn(run func()) *MaMGCPIn return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *MaMGCPInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // MaMGCPInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -675,7 +735,13 @@ func (_e *MaMGCPInterface_Expecter) UpdateUseCaseAvailability(available interfac func (_c *MaMGCPInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *MaMGCPInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -685,14 +751,14 @@ func (_c *MaMGCPInterface_UpdateUseCaseAvailability_Call) Return() *MaMGCPInterf return _c } -func (_c *MaMGCPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *MaMGCPInterface_UpdateUseCaseAvailability_Call { +func (_c *MaMGCPInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *MaMGCPInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// VoltagePerPhase provides a mock function with given fields: entity -func (_m *MaMGCPInterface) VoltagePerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { - ret := _m.Called(entity) +// VoltagePerPhase provides a mock function for the type MaMGCPInterface +func (_mock *MaMGCPInterface) VoltagePerPhase(entity api.EntityRemoteInterface) ([]float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for VoltagePerPhase") @@ -700,23 +766,21 @@ func (_m *MaMGCPInterface) VoltagePerPhase(entity spine_goapi.EntityRemoteInterf var r0 []float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -726,38 +790,30 @@ type MaMGCPInterface_VoltagePerPhase_Call struct { } // VoltagePerPhase is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMGCPInterface_Expecter) VoltagePerPhase(entity interface{}) *MaMGCPInterface_VoltagePerPhase_Call { return &MaMGCPInterface_VoltagePerPhase_Call{Call: _e.mock.On("VoltagePerPhase", entity)} } -func (_c *MaMGCPInterface_VoltagePerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMGCPInterface_VoltagePerPhase_Call { +func (_c *MaMGCPInterface_VoltagePerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMGCPInterface_VoltagePerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMGCPInterface_VoltagePerPhase_Call) Return(_a0 []float64, _a1 error) *MaMGCPInterface_VoltagePerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMGCPInterface_VoltagePerPhase_Call) Return(float64s []float64, err error) *MaMGCPInterface_VoltagePerPhase_Call { + _c.Call.Return(float64s, err) return _c } -func (_c *MaMGCPInterface_VoltagePerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *MaMGCPInterface_VoltagePerPhase_Call { +func (_c *MaMGCPInterface_VoltagePerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *MaMGCPInterface_VoltagePerPhase_Call { _c.Call.Return(run) return _c } - -// NewMaMGCPInterface creates a new instance of MaMGCPInterface. 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 NewMaMGCPInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MaMGCPInterface { - mock := &MaMGCPInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/MaMPCInterface.go b/usecases/mocks/MaMPCInterface.go index 0e6a4ea0..840ae2f4 100644 --- a/usecases/mocks/MaMPCInterface.go +++ b/usecases/mocks/MaMPCInterface.go @@ -1,14 +1,29 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" + api0 "github.com/enbility/eebus-go/api" + "github.com/enbility/spine-go/api" mock "github.com/stretchr/testify/mock" - - spine_goapi "github.com/enbility/spine-go/api" ) +// NewMaMPCInterface creates a new instance of MaMPCInterface. 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 NewMaMPCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MaMPCInterface { + mock := &MaMPCInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // MaMPCInterface is an autogenerated mock type for the MaMPCInterface type type MaMPCInterface struct { mock.Mock @@ -22,21 +37,20 @@ func (_m *MaMPCInterface) EXPECT() *MaMPCInterface_Expecter { return &MaMPCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *MaMPCInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -57,8 +71,8 @@ func (_c *MaMPCInterface_AddFeatures_Call) Run(run func()) *MaMPCInterface_AddFe return _c } -func (_c *MaMPCInterface_AddFeatures_Call) Return(_a0 error) *MaMPCInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *MaMPCInterface_AddFeatures_Call) Return(err error) *MaMPCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -67,9 +81,10 @@ func (_c *MaMPCInterface_AddFeatures_Call) RunAndReturn(run func() error) *MaMPC return _c } -// AddUseCase provides a mock function with no fields -func (_m *MaMPCInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) AddUseCase() { + _mock.Called() + return } // MaMPCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -99,23 +114,22 @@ func (_c *MaMPCInterface_AddUseCase_Call) RunAndReturn(run func()) *MaMPCInterfa return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *MaMPCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -125,31 +139,37 @@ type MaMPCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *MaMPCInterface_AvailableScenariosForEntity_Call { return &MaMPCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_AvailableScenariosForEntity_Call { +func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *MaMPCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *MaMPCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *MaMPCInterface_AvailableScenariosForEntity_Call { +func (_c *MaMPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *MaMPCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentPerPhase provides a mock function with given fields: entity -func (_m *MaMPCInterface) CurrentPerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { - ret := _m.Called(entity) +// CurrentPerPhase provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) CurrentPerPhase(entity api.EntityRemoteInterface) ([]float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for CurrentPerPhase") @@ -157,23 +177,21 @@ func (_m *MaMPCInterface) CurrentPerPhase(entity spine_goapi.EntityRemoteInterfa var r0 []float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -183,31 +201,37 @@ type MaMPCInterface_CurrentPerPhase_Call struct { } // CurrentPerPhase is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) CurrentPerPhase(entity interface{}) *MaMPCInterface_CurrentPerPhase_Call { return &MaMPCInterface_CurrentPerPhase_Call{Call: _e.mock.On("CurrentPerPhase", entity)} } -func (_c *MaMPCInterface_CurrentPerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_CurrentPerPhase_Call { +func (_c *MaMPCInterface_CurrentPerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_CurrentPerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMPCInterface_CurrentPerPhase_Call) Return(_a0 []float64, _a1 error) *MaMPCInterface_CurrentPerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMPCInterface_CurrentPerPhase_Call) Return(float64s []float64, err error) *MaMPCInterface_CurrentPerPhase_Call { + _c.Call.Return(float64s, err) return _c } -func (_c *MaMPCInterface_CurrentPerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_CurrentPerPhase_Call { +func (_c *MaMPCInterface_CurrentPerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_CurrentPerPhase_Call { _c.Call.Return(run) return _c } -// EnergyConsumed provides a mock function with given fields: entity -func (_m *MaMPCInterface) EnergyConsumed(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// EnergyConsumed provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) EnergyConsumed(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyConsumed") @@ -215,21 +239,19 @@ func (_m *MaMPCInterface) EnergyConsumed(entity spine_goapi.EntityRemoteInterfac var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -239,31 +261,37 @@ type MaMPCInterface_EnergyConsumed_Call struct { } // EnergyConsumed is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) EnergyConsumed(entity interface{}) *MaMPCInterface_EnergyConsumed_Call { return &MaMPCInterface_EnergyConsumed_Call{Call: _e.mock.On("EnergyConsumed", entity)} } -func (_c *MaMPCInterface_EnergyConsumed_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_EnergyConsumed_Call { +func (_c *MaMPCInterface_EnergyConsumed_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_EnergyConsumed_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMPCInterface_EnergyConsumed_Call) Return(_a0 float64, _a1 error) *MaMPCInterface_EnergyConsumed_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMPCInterface_EnergyConsumed_Call) Return(f float64, err error) *MaMPCInterface_EnergyConsumed_Call { + _c.Call.Return(f, err) return _c } -func (_c *MaMPCInterface_EnergyConsumed_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMPCInterface_EnergyConsumed_Call { +func (_c *MaMPCInterface_EnergyConsumed_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMPCInterface_EnergyConsumed_Call { _c.Call.Return(run) return _c } -// EnergyProduced provides a mock function with given fields: entity -func (_m *MaMPCInterface) EnergyProduced(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// EnergyProduced provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) EnergyProduced(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for EnergyProduced") @@ -271,21 +299,19 @@ func (_m *MaMPCInterface) EnergyProduced(entity spine_goapi.EntityRemoteInterfac var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -295,31 +321,37 @@ type MaMPCInterface_EnergyProduced_Call struct { } // EnergyProduced is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) EnergyProduced(entity interface{}) *MaMPCInterface_EnergyProduced_Call { return &MaMPCInterface_EnergyProduced_Call{Call: _e.mock.On("EnergyProduced", entity)} } -func (_c *MaMPCInterface_EnergyProduced_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_EnergyProduced_Call { +func (_c *MaMPCInterface_EnergyProduced_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_EnergyProduced_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMPCInterface_EnergyProduced_Call) Return(_a0 float64, _a1 error) *MaMPCInterface_EnergyProduced_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMPCInterface_EnergyProduced_Call) Return(f float64, err error) *MaMPCInterface_EnergyProduced_Call { + _c.Call.Return(f, err) return _c } -func (_c *MaMPCInterface_EnergyProduced_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMPCInterface_EnergyProduced_Call { +func (_c *MaMPCInterface_EnergyProduced_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMPCInterface_EnergyProduced_Call { _c.Call.Return(run) return _c } -// Frequency provides a mock function with given fields: entity -func (_m *MaMPCInterface) Frequency(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// Frequency provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) Frequency(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for Frequency") @@ -327,21 +359,19 @@ func (_m *MaMPCInterface) Frequency(entity spine_goapi.EntityRemoteInterface) (f var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -351,43 +381,48 @@ type MaMPCInterface_Frequency_Call struct { } // Frequency is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) Frequency(entity interface{}) *MaMPCInterface_Frequency_Call { return &MaMPCInterface_Frequency_Call{Call: _e.mock.On("Frequency", entity)} } -func (_c *MaMPCInterface_Frequency_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_Frequency_Call { +func (_c *MaMPCInterface_Frequency_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_Frequency_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMPCInterface_Frequency_Call) Return(_a0 float64, _a1 error) *MaMPCInterface_Frequency_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMPCInterface_Frequency_Call) Return(f float64, err error) *MaMPCInterface_Frequency_Call { + _c.Call.Return(f, err) return _c } -func (_c *MaMPCInterface_Frequency_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMPCInterface_Frequency_Call { +func (_c *MaMPCInterface_Frequency_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMPCInterface_Frequency_Call { _c.Call.Return(run) return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *MaMPCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -397,43 +432,48 @@ type MaMPCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *MaMPCInterface_IsCompatibleEntityType_Call { return &MaMPCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *MaMPCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_IsCompatibleEntityType_Call { +func (_c *MaMPCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMPCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *MaMPCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *MaMPCInterface_IsCompatibleEntityType_Call) Return(b bool) *MaMPCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *MaMPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *MaMPCInterface_IsCompatibleEntityType_Call { +func (_c *MaMPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *MaMPCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *MaMPCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -443,32 +483,43 @@ type MaMPCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *MaMPCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { return &MaMPCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *MaMPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *MaMPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// Power provides a mock function with given fields: entity -func (_m *MaMPCInterface) Power(entity spine_goapi.EntityRemoteInterface) (float64, error) { - ret := _m.Called(entity) +// Power provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) Power(entity api.EntityRemoteInterface) (float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for Power") @@ -476,21 +527,19 @@ func (_m *MaMPCInterface) Power(entity spine_goapi.EntityRemoteInterface) (float var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) (float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) (float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) float64); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -500,31 +549,37 @@ type MaMPCInterface_Power_Call struct { } // Power is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) Power(entity interface{}) *MaMPCInterface_Power_Call { return &MaMPCInterface_Power_Call{Call: _e.mock.On("Power", entity)} } -func (_c *MaMPCInterface_Power_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_Power_Call { +func (_c *MaMPCInterface_Power_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_Power_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMPCInterface_Power_Call) Return(_a0 float64, _a1 error) *MaMPCInterface_Power_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMPCInterface_Power_Call) Return(f float64, err error) *MaMPCInterface_Power_Call { + _c.Call.Return(f, err) return _c } -func (_c *MaMPCInterface_Power_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) (float64, error)) *MaMPCInterface_Power_Call { +func (_c *MaMPCInterface_Power_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) (float64, error)) *MaMPCInterface_Power_Call { _c.Call.Return(run) return _c } -// PowerPerPhase provides a mock function with given fields: entity -func (_m *MaMPCInterface) PowerPerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { - ret := _m.Called(entity) +// PowerPerPhase provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) PowerPerPhase(entity api.EntityRemoteInterface) ([]float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for PowerPerPhase") @@ -532,23 +587,21 @@ func (_m *MaMPCInterface) PowerPerPhase(entity spine_goapi.EntityRemoteInterface var r0 []float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -558,45 +611,50 @@ type MaMPCInterface_PowerPerPhase_Call struct { } // PowerPerPhase is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) PowerPerPhase(entity interface{}) *MaMPCInterface_PowerPerPhase_Call { return &MaMPCInterface_PowerPerPhase_Call{Call: _e.mock.On("PowerPerPhase", entity)} } -func (_c *MaMPCInterface_PowerPerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_PowerPerPhase_Call { +func (_c *MaMPCInterface_PowerPerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_PowerPerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMPCInterface_PowerPerPhase_Call) Return(_a0 []float64, _a1 error) *MaMPCInterface_PowerPerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMPCInterface_PowerPerPhase_Call) Return(float64s []float64, err error) *MaMPCInterface_PowerPerPhase_Call { + _c.Call.Return(float64s, err) return _c } -func (_c *MaMPCInterface_PowerPerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_PowerPerPhase_Call { +func (_c *MaMPCInterface_PowerPerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_PowerPerPhase_Call { _c.Call.Return(run) return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *MaMPCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api0.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api0.RemoteEntityScenarios) } } - return r0 } @@ -617,19 +675,20 @@ func (_c *MaMPCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *MaMPCInt return _c } -func (_c *MaMPCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *MaMPCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *MaMPCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *MaMPCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *MaMPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *MaMPCInterface_RemoteEntitiesScenarios_Call { +func (_c *MaMPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *MaMPCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *MaMPCInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) RemoveUseCase() { + _mock.Called() + return } // MaMPCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -659,9 +718,10 @@ func (_c *MaMPCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *MaMPCInte return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *MaMPCInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // MaMPCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -677,7 +737,13 @@ func (_e *MaMPCInterface_Expecter) UpdateUseCaseAvailability(available interface func (_c *MaMPCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *MaMPCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -687,14 +753,14 @@ func (_c *MaMPCInterface_UpdateUseCaseAvailability_Call) Return() *MaMPCInterfac return _c } -func (_c *MaMPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *MaMPCInterface_UpdateUseCaseAvailability_Call { +func (_c *MaMPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *MaMPCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// VoltagePerPhase provides a mock function with given fields: entity -func (_m *MaMPCInterface) VoltagePerPhase(entity spine_goapi.EntityRemoteInterface) ([]float64, error) { - ret := _m.Called(entity) +// VoltagePerPhase provides a mock function for the type MaMPCInterface +func (_mock *MaMPCInterface) VoltagePerPhase(entity api.EntityRemoteInterface) ([]float64, error) { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for VoltagePerPhase") @@ -702,23 +768,21 @@ func (_m *MaMPCInterface) VoltagePerPhase(entity spine_goapi.EntityRemoteInterfa var r0 []float64 var r1 error - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) ([]float64, error)); ok { - return rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) ([]float64, error)); ok { + return returnFunc(entity) } - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []float64); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []float64); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]float64) } } - - if rf, ok := ret.Get(1).(func(spine_goapi.EntityRemoteInterface) error); ok { - r1 = rf(entity) + if returnFunc, ok := ret.Get(1).(func(api.EntityRemoteInterface) error); ok { + r1 = returnFunc(entity) } else { r1 = ret.Error(1) } - return r0, r1 } @@ -728,38 +792,30 @@ type MaMPCInterface_VoltagePerPhase_Call struct { } // VoltagePerPhase is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MaMPCInterface_Expecter) VoltagePerPhase(entity interface{}) *MaMPCInterface_VoltagePerPhase_Call { return &MaMPCInterface_VoltagePerPhase_Call{Call: _e.mock.On("VoltagePerPhase", entity)} } -func (_c *MaMPCInterface_VoltagePerPhase_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MaMPCInterface_VoltagePerPhase_Call { +func (_c *MaMPCInterface_VoltagePerPhase_Call) Run(run func(entity api.EntityRemoteInterface)) *MaMPCInterface_VoltagePerPhase_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MaMPCInterface_VoltagePerPhase_Call) Return(_a0 []float64, _a1 error) *MaMPCInterface_VoltagePerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *MaMPCInterface_VoltagePerPhase_Call) Return(float64s []float64, err error) *MaMPCInterface_VoltagePerPhase_Call { + _c.Call.Return(float64s, err) return _c } -func (_c *MaMPCInterface_VoltagePerPhase_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_VoltagePerPhase_Call { +func (_c *MaMPCInterface_VoltagePerPhase_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) ([]float64, error)) *MaMPCInterface_VoltagePerPhase_Call { _c.Call.Return(run) return _c } - -// NewMaMPCInterface creates a new instance of MaMPCInterface. 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 NewMaMPCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MaMPCInterface { - mock := &MaMPCInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/MuMPCInterface.go b/usecases/mocks/MuMPCInterface.go index 6f343ea0..9633281a 100644 --- a/usecases/mocks/MuMPCInterface.go +++ b/usecases/mocks/MuMPCInterface.go @@ -1,19 +1,32 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - eebus_goapi "github.com/enbility/eebus-go/api" - api "github.com/enbility/eebus-go/usecases/api" + "time" + api0 "github.com/enbility/eebus-go/api" + api1 "github.com/enbility/eebus-go/usecases/api" + "github.com/enbility/spine-go/api" + "github.com/enbility/spine-go/model" mock "github.com/stretchr/testify/mock" +) - model "github.com/enbility/spine-go/model" +// NewMuMPCInterface creates a new instance of MuMPCInterface. 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 NewMuMPCInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MuMPCInterface { + mock := &MuMPCInterface{} + mock.Mock.Test(t) - spine_goapi "github.com/enbility/spine-go/api" + t.Cleanup(func() { mock.AssertExpectations(t) }) - time "time" -) + return mock +} // MuMPCInterface is an autogenerated mock type for the MuMPCInterface type type MuMPCInterface struct { @@ -28,21 +41,20 @@ func (_m *MuMPCInterface) EXPECT() *MuMPCInterface_Expecter { return &MuMPCInterface_Expecter{mock: &_m.Mock} } -// AddFeatures provides a mock function with no fields -func (_m *MuMPCInterface) AddFeatures() error { - ret := _m.Called() +// AddFeatures provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) AddFeatures() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for AddFeatures") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -63,8 +75,8 @@ func (_c *MuMPCInterface_AddFeatures_Call) Run(run func()) *MuMPCInterface_AddFe return _c } -func (_c *MuMPCInterface_AddFeatures_Call) Return(_a0 error) *MuMPCInterface_AddFeatures_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_AddFeatures_Call) Return(err error) *MuMPCInterface_AddFeatures_Call { + _c.Call.Return(err) return _c } @@ -73,9 +85,10 @@ func (_c *MuMPCInterface_AddFeatures_Call) RunAndReturn(run func() error) *MuMPC return _c } -// AddUseCase provides a mock function with no fields -func (_m *MuMPCInterface) AddUseCase() { - _m.Called() +// AddUseCase provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) AddUseCase() { + _mock.Called() + return } // MuMPCInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase' @@ -105,23 +118,22 @@ func (_c *MuMPCInterface_AddUseCase_Call) RunAndReturn(run func()) *MuMPCInterfa return _c } -// AvailableScenariosForEntity provides a mock function with given fields: entity -func (_m *MuMPCInterface) AvailableScenariosForEntity(entity spine_goapi.EntityRemoteInterface) []uint { - ret := _m.Called(entity) +// AvailableScenariosForEntity provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) AvailableScenariosForEntity(entity api.EntityRemoteInterface) []uint { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for AvailableScenariosForEntity") } var r0 []uint - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) []uint); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) []uint); ok { + r0 = returnFunc(entity) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]uint) } } - return r0 } @@ -131,31 +143,37 @@ type MuMPCInterface_AvailableScenariosForEntity_Call struct { } // AvailableScenariosForEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MuMPCInterface_Expecter) AvailableScenariosForEntity(entity interface{}) *MuMPCInterface_AvailableScenariosForEntity_Call { return &MuMPCInterface_AvailableScenariosForEntity_Call{Call: _e.mock.On("AvailableScenariosForEntity", entity)} } -func (_c *MuMPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MuMPCInterface_AvailableScenariosForEntity_Call { +func (_c *MuMPCInterface_AvailableScenariosForEntity_Call) Run(run func(entity api.EntityRemoteInterface)) *MuMPCInterface_AvailableScenariosForEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MuMPCInterface_AvailableScenariosForEntity_Call) Return(_a0 []uint) *MuMPCInterface_AvailableScenariosForEntity_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_AvailableScenariosForEntity_Call) Return(uints []uint) *MuMPCInterface_AvailableScenariosForEntity_Call { + _c.Call.Return(uints) return _c } -func (_c *MuMPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) []uint) *MuMPCInterface_AvailableScenariosForEntity_Call { +func (_c *MuMPCInterface_AvailableScenariosForEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) []uint) *MuMPCInterface_AvailableScenariosForEntity_Call { _c.Call.Return(run) return _c } -// CurrentPerPhase provides a mock function with no fields -func (_m *MuMPCInterface) CurrentPerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { - ret := _m.Called() +// CurrentPerPhase provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) CurrentPerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for CurrentPerPhase") @@ -163,23 +181,21 @@ func (_m *MuMPCInterface) CurrentPerPhase() (map[model.ElectricalConnectionPhase var r0 map[model.ElectricalConnectionPhaseNameType]float64 var r1 error - if rf, ok := ret.Get(0).(func() (map[model.ElectricalConnectionPhaseNameType]float64, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (map[model.ElectricalConnectionPhaseNameType]float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() map[model.ElectricalConnectionPhaseNameType]float64); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() map[model.ElectricalConnectionPhaseNameType]float64); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(map[model.ElectricalConnectionPhaseNameType]float64) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -200,8 +216,8 @@ func (_c *MuMPCInterface_CurrentPerPhase_Call) Run(run func()) *MuMPCInterface_C return _c } -func (_c *MuMPCInterface_CurrentPerPhase_Call) Return(_a0 map[model.ElectricalConnectionPhaseNameType]float64, _a1 error) *MuMPCInterface_CurrentPerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *MuMPCInterface_CurrentPerPhase_Call) Return(electricalConnectionPhaseNameTypeToFloat64 map[model.ElectricalConnectionPhaseNameType]float64, err error) *MuMPCInterface_CurrentPerPhase_Call { + _c.Call.Return(electricalConnectionPhaseNameTypeToFloat64, err) return _c } @@ -210,9 +226,9 @@ func (_c *MuMPCInterface_CurrentPerPhase_Call) RunAndReturn(run func() (map[mode return _c } -// EnergyConsumed provides a mock function with no fields -func (_m *MuMPCInterface) EnergyConsumed() (float64, error) { - ret := _m.Called() +// EnergyConsumed provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) EnergyConsumed() (float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for EnergyConsumed") @@ -220,21 +236,19 @@ func (_m *MuMPCInterface) EnergyConsumed() (float64, error) { var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func() (float64, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() float64); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -255,8 +269,8 @@ func (_c *MuMPCInterface_EnergyConsumed_Call) Run(run func()) *MuMPCInterface_En return _c } -func (_c *MuMPCInterface_EnergyConsumed_Call) Return(_a0 float64, _a1 error) *MuMPCInterface_EnergyConsumed_Call { - _c.Call.Return(_a0, _a1) +func (_c *MuMPCInterface_EnergyConsumed_Call) Return(f float64, err error) *MuMPCInterface_EnergyConsumed_Call { + _c.Call.Return(f, err) return _c } @@ -265,9 +279,9 @@ func (_c *MuMPCInterface_EnergyConsumed_Call) RunAndReturn(run func() (float64, return _c } -// EnergyProduced provides a mock function with no fields -func (_m *MuMPCInterface) EnergyProduced() (float64, error) { - ret := _m.Called() +// EnergyProduced provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) EnergyProduced() (float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for EnergyProduced") @@ -275,21 +289,19 @@ func (_m *MuMPCInterface) EnergyProduced() (float64, error) { var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func() (float64, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() float64); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -310,8 +322,8 @@ func (_c *MuMPCInterface_EnergyProduced_Call) Run(run func()) *MuMPCInterface_En return _c } -func (_c *MuMPCInterface_EnergyProduced_Call) Return(_a0 float64, _a1 error) *MuMPCInterface_EnergyProduced_Call { - _c.Call.Return(_a0, _a1) +func (_c *MuMPCInterface_EnergyProduced_Call) Return(f float64, err error) *MuMPCInterface_EnergyProduced_Call { + _c.Call.Return(f, err) return _c } @@ -320,9 +332,9 @@ func (_c *MuMPCInterface_EnergyProduced_Call) RunAndReturn(run func() (float64, return _c } -// Frequency provides a mock function with no fields -func (_m *MuMPCInterface) Frequency() (float64, error) { - ret := _m.Called() +// Frequency provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) Frequency() (float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Frequency") @@ -330,21 +342,19 @@ func (_m *MuMPCInterface) Frequency() (float64, error) { var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func() (float64, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() float64); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -365,8 +375,8 @@ func (_c *MuMPCInterface_Frequency_Call) Run(run func()) *MuMPCInterface_Frequen return _c } -func (_c *MuMPCInterface_Frequency_Call) Return(_a0 float64, _a1 error) *MuMPCInterface_Frequency_Call { - _c.Call.Return(_a0, _a1) +func (_c *MuMPCInterface_Frequency_Call) Return(f float64, err error) *MuMPCInterface_Frequency_Call { + _c.Call.Return(f, err) return _c } @@ -375,21 +385,20 @@ func (_c *MuMPCInterface_Frequency_Call) RunAndReturn(run func() (float64, error return _c } -// IsCompatibleEntityType provides a mock function with given fields: entity -func (_m *MuMPCInterface) IsCompatibleEntityType(entity spine_goapi.EntityRemoteInterface) bool { - ret := _m.Called(entity) +// IsCompatibleEntityType provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) IsCompatibleEntityType(entity api.EntityRemoteInterface) bool { + ret := _mock.Called(entity) if len(ret) == 0 { panic("no return value specified for IsCompatibleEntityType") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface) bool); ok { - r0 = rf(entity) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface) bool); ok { + r0 = returnFunc(entity) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -399,43 +408,48 @@ type MuMPCInterface_IsCompatibleEntityType_Call struct { } // IsCompatibleEntityType is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface func (_e *MuMPCInterface_Expecter) IsCompatibleEntityType(entity interface{}) *MuMPCInterface_IsCompatibleEntityType_Call { return &MuMPCInterface_IsCompatibleEntityType_Call{Call: _e.mock.On("IsCompatibleEntityType", entity)} } -func (_c *MuMPCInterface_IsCompatibleEntityType_Call) Run(run func(entity spine_goapi.EntityRemoteInterface)) *MuMPCInterface_IsCompatibleEntityType_Call { +func (_c *MuMPCInterface_IsCompatibleEntityType_Call) Run(run func(entity api.EntityRemoteInterface)) *MuMPCInterface_IsCompatibleEntityType_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + run( + arg0, + ) }) return _c } -func (_c *MuMPCInterface_IsCompatibleEntityType_Call) Return(_a0 bool) *MuMPCInterface_IsCompatibleEntityType_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_IsCompatibleEntityType_Call) Return(b bool) *MuMPCInterface_IsCompatibleEntityType_Call { + _c.Call.Return(b) return _c } -func (_c *MuMPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface) bool) *MuMPCInterface_IsCompatibleEntityType_Call { +func (_c *MuMPCInterface_IsCompatibleEntityType_Call) RunAndReturn(run func(entity api.EntityRemoteInterface) bool) *MuMPCInterface_IsCompatibleEntityType_Call { _c.Call.Return(run) return _c } -// IsScenarioAvailableAtEntity provides a mock function with given fields: entity, scenario -func (_m *MuMPCInterface) IsScenarioAvailableAtEntity(entity spine_goapi.EntityRemoteInterface, scenario uint) bool { - ret := _m.Called(entity, scenario) +// IsScenarioAvailableAtEntity provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) IsScenarioAvailableAtEntity(entity api.EntityRemoteInterface, scenario uint) bool { + ret := _mock.Called(entity, scenario) if len(ret) == 0 { panic("no return value specified for IsScenarioAvailableAtEntity") } var r0 bool - if rf, ok := ret.Get(0).(func(spine_goapi.EntityRemoteInterface, uint) bool); ok { - r0 = rf(entity, scenario) + if returnFunc, ok := ret.Get(0).(func(api.EntityRemoteInterface, uint) bool); ok { + r0 = returnFunc(entity, scenario) } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -445,32 +459,43 @@ type MuMPCInterface_IsScenarioAvailableAtEntity_Call struct { } // IsScenarioAvailableAtEntity is a helper method to define mock.On call -// - entity spine_goapi.EntityRemoteInterface +// - entity api.EntityRemoteInterface // - scenario uint func (_e *MuMPCInterface_Expecter) IsScenarioAvailableAtEntity(entity interface{}, scenario interface{}) *MuMPCInterface_IsScenarioAvailableAtEntity_Call { return &MuMPCInterface_IsScenarioAvailableAtEntity_Call{Call: _e.mock.On("IsScenarioAvailableAtEntity", entity, scenario)} } -func (_c *MuMPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity spine_goapi.EntityRemoteInterface, scenario uint)) *MuMPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *MuMPCInterface_IsScenarioAvailableAtEntity_Call) Run(run func(entity api.EntityRemoteInterface, scenario uint)) *MuMPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint)) + var arg0 api.EntityRemoteInterface + if args[0] != nil { + arg0 = args[0].(api.EntityRemoteInterface) + } + var arg1 uint + if args[1] != nil { + arg1 = args[1].(uint) + } + run( + arg0, + arg1, + ) }) return _c } -func (_c *MuMPCInterface_IsScenarioAvailableAtEntity_Call) Return(_a0 bool) *MuMPCInterface_IsScenarioAvailableAtEntity_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_IsScenarioAvailableAtEntity_Call) Return(b bool) *MuMPCInterface_IsScenarioAvailableAtEntity_Call { + _c.Call.Return(b) return _c } -func (_c *MuMPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(spine_goapi.EntityRemoteInterface, uint) bool) *MuMPCInterface_IsScenarioAvailableAtEntity_Call { +func (_c *MuMPCInterface_IsScenarioAvailableAtEntity_Call) RunAndReturn(run func(entity api.EntityRemoteInterface, scenario uint) bool) *MuMPCInterface_IsScenarioAvailableAtEntity_Call { _c.Call.Return(run) return _c } -// Power provides a mock function with no fields -func (_m *MuMPCInterface) Power() (float64, error) { - ret := _m.Called() +// Power provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) Power() (float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Power") @@ -478,21 +503,19 @@ func (_m *MuMPCInterface) Power() (float64, error) { var r0 float64 var r1 error - if rf, ok := ret.Get(0).(func() (float64, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() float64); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() float64); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(float64) } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -513,8 +536,8 @@ func (_c *MuMPCInterface_Power_Call) Run(run func()) *MuMPCInterface_Power_Call return _c } -func (_c *MuMPCInterface_Power_Call) Return(_a0 float64, _a1 error) *MuMPCInterface_Power_Call { - _c.Call.Return(_a0, _a1) +func (_c *MuMPCInterface_Power_Call) Return(f float64, err error) *MuMPCInterface_Power_Call { + _c.Call.Return(f, err) return _c } @@ -523,9 +546,9 @@ func (_c *MuMPCInterface_Power_Call) RunAndReturn(run func() (float64, error)) * return _c } -// PowerPerPhase provides a mock function with no fields -func (_m *MuMPCInterface) PowerPerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { - ret := _m.Called() +// PowerPerPhase provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) PowerPerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for PowerPerPhase") @@ -533,23 +556,21 @@ func (_m *MuMPCInterface) PowerPerPhase() (map[model.ElectricalConnectionPhaseNa var r0 map[model.ElectricalConnectionPhaseNameType]float64 var r1 error - if rf, ok := ret.Get(0).(func() (map[model.ElectricalConnectionPhaseNameType]float64, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (map[model.ElectricalConnectionPhaseNameType]float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() map[model.ElectricalConnectionPhaseNameType]float64); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() map[model.ElectricalConnectionPhaseNameType]float64); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(map[model.ElectricalConnectionPhaseNameType]float64) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -570,8 +591,8 @@ func (_c *MuMPCInterface_PowerPerPhase_Call) Run(run func()) *MuMPCInterface_Pow return _c } -func (_c *MuMPCInterface_PowerPerPhase_Call) Return(_a0 map[model.ElectricalConnectionPhaseNameType]float64, _a1 error) *MuMPCInterface_PowerPerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *MuMPCInterface_PowerPerPhase_Call) Return(electricalConnectionPhaseNameTypeToFloat64 map[model.ElectricalConnectionPhaseNameType]float64, err error) *MuMPCInterface_PowerPerPhase_Call { + _c.Call.Return(electricalConnectionPhaseNameTypeToFloat64, err) return _c } @@ -580,23 +601,22 @@ func (_c *MuMPCInterface_PowerPerPhase_Call) RunAndReturn(run func() (map[model. return _c } -// RemoteEntitiesScenarios provides a mock function with no fields -func (_m *MuMPCInterface) RemoteEntitiesScenarios() []eebus_goapi.RemoteEntityScenarios { - ret := _m.Called() +// RemoteEntitiesScenarios provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) RemoteEntitiesScenarios() []api0.RemoteEntityScenarios { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for RemoteEntitiesScenarios") } - var r0 []eebus_goapi.RemoteEntityScenarios - if rf, ok := ret.Get(0).(func() []eebus_goapi.RemoteEntityScenarios); ok { - r0 = rf() + var r0 []api0.RemoteEntityScenarios + if returnFunc, ok := ret.Get(0).(func() []api0.RemoteEntityScenarios); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]eebus_goapi.RemoteEntityScenarios) + r0 = ret.Get(0).([]api0.RemoteEntityScenarios) } } - return r0 } @@ -617,19 +637,20 @@ func (_c *MuMPCInterface_RemoteEntitiesScenarios_Call) Run(run func()) *MuMPCInt return _c } -func (_c *MuMPCInterface_RemoteEntitiesScenarios_Call) Return(_a0 []eebus_goapi.RemoteEntityScenarios) *MuMPCInterface_RemoteEntitiesScenarios_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_RemoteEntitiesScenarios_Call) Return(remoteEntityScenarioss []api0.RemoteEntityScenarios) *MuMPCInterface_RemoteEntitiesScenarios_Call { + _c.Call.Return(remoteEntityScenarioss) return _c } -func (_c *MuMPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []eebus_goapi.RemoteEntityScenarios) *MuMPCInterface_RemoteEntitiesScenarios_Call { +func (_c *MuMPCInterface_RemoteEntitiesScenarios_Call) RunAndReturn(run func() []api0.RemoteEntityScenarios) *MuMPCInterface_RemoteEntitiesScenarios_Call { _c.Call.Return(run) return _c } -// RemoveUseCase provides a mock function with no fields -func (_m *MuMPCInterface) RemoveUseCase() { - _m.Called() +// RemoveUseCase provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) RemoveUseCase() { + _mock.Called() + return } // MuMPCInterface_RemoveUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUseCase' @@ -659,27 +680,26 @@ func (_c *MuMPCInterface_RemoveUseCase_Call) RunAndReturn(run func()) *MuMPCInte return _c } -// Update provides a mock function with given fields: data -func (_m *MuMPCInterface) Update(data ...api.UpdateMeasurementData) error { - _va := make([]interface{}, len(data)) - for _i := range data { - _va[_i] = data[_i] +// Update provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) Update(data ...api1.UpdateMeasurementData) error { + var tmpRet mock.Arguments + if len(data) > 0 { + tmpRet = _mock.Called(data) + } else { + tmpRet = _mock.Called() } - var _ca []interface{} - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) + ret := tmpRet if len(ret) == 0 { panic("no return value specified for Update") } var r0 error - if rf, ok := ret.Get(0).(func(...api.UpdateMeasurementData) error); ok { - r0 = rf(data...) + if returnFunc, ok := ret.Get(0).(func(...api1.UpdateMeasurementData) error); ok { + r0 = returnFunc(data...) } else { r0 = ret.Error(0) } - return r0 } @@ -689,52 +709,53 @@ type MuMPCInterface_Update_Call struct { } // Update is a helper method to define mock.On call -// - data ...api.UpdateMeasurementData +// - data ...api1.UpdateMeasurementData func (_e *MuMPCInterface_Expecter) Update(data ...interface{}) *MuMPCInterface_Update_Call { return &MuMPCInterface_Update_Call{Call: _e.mock.On("Update", append([]interface{}{}, data...)...)} } -func (_c *MuMPCInterface_Update_Call) Run(run func(data ...api.UpdateMeasurementData)) *MuMPCInterface_Update_Call { +func (_c *MuMPCInterface_Update_Call) Run(run func(data ...api1.UpdateMeasurementData)) *MuMPCInterface_Update_Call { _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]api.UpdateMeasurementData, len(args)-0) - for i, a := range args[0:] { - if a != nil { - variadicArgs[i] = a.(api.UpdateMeasurementData) - } + var arg0 []api1.UpdateMeasurementData + var variadicArgs []api1.UpdateMeasurementData + if len(args) > 0 { + variadicArgs = args[0].([]api1.UpdateMeasurementData) } - run(variadicArgs...) + arg0 = variadicArgs + run( + arg0..., + ) }) return _c } -func (_c *MuMPCInterface_Update_Call) Return(_a0 error) *MuMPCInterface_Update_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_Update_Call) Return(err error) *MuMPCInterface_Update_Call { + _c.Call.Return(err) return _c } -func (_c *MuMPCInterface_Update_Call) RunAndReturn(run func(...api.UpdateMeasurementData) error) *MuMPCInterface_Update_Call { +func (_c *MuMPCInterface_Update_Call) RunAndReturn(run func(data ...api1.UpdateMeasurementData) error) *MuMPCInterface_Update_Call { _c.Call.Return(run) return _c } -// UpdateDataCurrentPhaseA provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataCurrentPhaseA provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataCurrentPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataCurrentPhaseA") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -753,38 +774,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataCurrentPhaseA(value interface{}, ti func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { +func (_c *MuMPCInterface_UpdateDataCurrentPhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseA_Call { _c.Call.Return(run) return _c } -// UpdateDataCurrentPhaseB provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataCurrentPhaseB provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataCurrentPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataCurrentPhaseB") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -803,38 +839,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataCurrentPhaseB(value interface{}, ti func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { +func (_c *MuMPCInterface_UpdateDataCurrentPhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseB_Call { _c.Call.Return(run) return _c } -// UpdateDataCurrentPhaseC provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataCurrentPhaseC provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataCurrentPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataCurrentPhaseC") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -853,38 +904,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataCurrentPhaseC(value interface{}, ti func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { +func (_c *MuMPCInterface_UpdateDataCurrentPhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataCurrentPhaseC_Call { _c.Call.Return(run) return _c } -// UpdateDataEnergyConsumed provides a mock function with given fields: value, timestamp, valueState, evaluationStart, evaluationEnd -func (_m *MuMPCInterface) UpdateDataEnergyConsumed(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) +// UpdateDataEnergyConsumed provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataEnergyConsumed(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) if len(ret) == 0 { panic("no return value specified for UpdateDataEnergyConsumed") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState, evaluationStart, evaluationEnd) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState, evaluationStart, evaluationEnd) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -905,38 +971,63 @@ func (_e *MuMPCInterface_Expecter) UpdateDataEnergyConsumed(value interface{}, t func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time)) *MuMPCInterface_UpdateDataEnergyConsumed_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType), args[3].(*time.Time), args[4].(*time.Time)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + var arg3 *time.Time + if args[3] != nil { + arg3 = args[3].(*time.Time) + } + var arg4 *time.Time + if args[4] != nil { + arg4 = args[4].(*time.Time) + } + run( + arg0, + arg1, + arg2, + arg3, + arg4, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { +func (_c *MuMPCInterface_UpdateDataEnergyConsumed_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyConsumed_Call { _c.Call.Return(run) return _c } -// UpdateDataEnergyProduced provides a mock function with given fields: value, timestamp, valueState, evaluationStart, evaluationEnd -func (_m *MuMPCInterface) UpdateDataEnergyProduced(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) +// UpdateDataEnergyProduced provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataEnergyProduced(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState, evaluationStart, evaluationEnd) if len(ret) == 0 { panic("no return value specified for UpdateDataEnergyProduced") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState, evaluationStart, evaluationEnd) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState, evaluationStart, evaluationEnd) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -957,38 +1048,63 @@ func (_e *MuMPCInterface_Expecter) UpdateDataEnergyProduced(value interface{}, t func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time)) *MuMPCInterface_UpdateDataEnergyProduced_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType), args[3].(*time.Time), args[4].(*time.Time)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + var arg3 *time.Time + if args[3] != nil { + arg3 = args[3].(*time.Time) + } + var arg4 *time.Time + if args[4] != nil { + arg4 = args[4].(*time.Time) + } + run( + arg0, + arg1, + arg2, + arg3, + arg4, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyProduced_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyProduced_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType, *time.Time, *time.Time) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyProduced_Call { +func (_c *MuMPCInterface_UpdateDataEnergyProduced_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType, evaluationStart *time.Time, evaluationEnd *time.Time) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataEnergyProduced_Call { _c.Call.Return(run) return _c } -// UpdateDataFrequency provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataFrequency provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataFrequency(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataFrequency") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -1007,38 +1123,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataFrequency(value interface{}, timest func (_c *MuMPCInterface_UpdateDataFrequency_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataFrequency_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataFrequency_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataFrequency_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataFrequency_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataFrequency_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataFrequency_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataFrequency_Call { +func (_c *MuMPCInterface_UpdateDataFrequency_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataFrequency_Call { _c.Call.Return(run) return _c } -// UpdateDataPowerPhaseA provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataPowerPhaseA provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataPowerPhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerPhaseA") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -1057,38 +1188,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataPowerPhaseA(value interface{}, time func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerPhaseA_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { +func (_c *MuMPCInterface_UpdateDataPowerPhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseA_Call { _c.Call.Return(run) return _c } -// UpdateDataPowerPhaseB provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataPowerPhaseB provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataPowerPhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerPhaseB") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -1107,38 +1253,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataPowerPhaseB(value interface{}, time func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerPhaseB_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { +func (_c *MuMPCInterface_UpdateDataPowerPhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseB_Call { _c.Call.Return(run) return _c } -// UpdateDataPowerPhaseC provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataPowerPhaseC provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataPowerPhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerPhaseC") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -1157,38 +1318,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataPowerPhaseC(value interface{}, time func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerPhaseC_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { +func (_c *MuMPCInterface_UpdateDataPowerPhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerPhaseC_Call { _c.Call.Return(run) return _c } -// UpdateDataPowerTotal provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataPowerTotal provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataPowerTotal(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataPowerTotal") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -1207,38 +1383,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataPowerTotal(value interface{}, times func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataPowerTotal_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerTotal_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerTotal_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerTotal_Call { +func (_c *MuMPCInterface_UpdateDataPowerTotal_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataPowerTotal_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseA provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataVoltagePhaseA provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseA(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseA") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -1257,38 +1448,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseA(value interface{}, ti func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseA_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseA_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseAToB provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataVoltagePhaseAToB provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseAToB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseAToB") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -1307,38 +1513,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseAToB(value interface{}, func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToB_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseAToC provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataVoltagePhaseAToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataVoltagePhaseAToC provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseAToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseAToC") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -1357,38 +1578,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseAToC(value interface{}, func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseAToC_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseB provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataVoltagePhaseB provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseB(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseB") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -1407,38 +1643,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseB(value interface{}, ti func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseB_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseB_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseBToC provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataVoltagePhaseBToC provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseBToC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseBToC") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -1457,38 +1708,53 @@ func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseBToC(value interface{}, func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseBToC_Call { _c.Call.Return(run) return _c } -// UpdateDataVoltagePhaseC provides a mock function with given fields: value, timestamp, valueState -func (_m *MuMPCInterface) UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api.UpdateMeasurementData { - ret := _m.Called(value, timestamp, valueState) +// UpdateDataVoltagePhaseC provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateDataVoltagePhaseC(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData { + ret := _mock.Called(value, timestamp, valueState) if len(ret) == 0 { panic("no return value specified for UpdateDataVoltagePhaseC") } - var r0 api.UpdateMeasurementData - if rf, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData); ok { - r0 = rf(value, timestamp, valueState) + var r0 api1.UpdateMeasurementData + if returnFunc, ok := ret.Get(0).(func(float64, *time.Time, *model.MeasurementValueStateType) api1.UpdateMeasurementData); ok { + r0 = returnFunc(value, timestamp, valueState) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(api.UpdateMeasurementData) + r0 = ret.Get(0).(api1.UpdateMeasurementData) } } - return r0 } @@ -1507,24 +1773,41 @@ func (_e *MuMPCInterface_Expecter) UpdateDataVoltagePhaseC(value interface{}, ti func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) Run(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType)) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(float64), args[1].(*time.Time), args[2].(*model.MeasurementValueStateType)) + var arg0 float64 + if args[0] != nil { + arg0 = args[0].(float64) + } + var arg1 *time.Time + if args[1] != nil { + arg1 = args[1].(*time.Time) + } + var arg2 *model.MeasurementValueStateType + if args[2] != nil { + arg2 = args[2].(*model.MeasurementValueStateType) + } + run( + arg0, + arg1, + arg2, + ) }) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) Return(_a0 api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { - _c.Call.Return(_a0) +func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) Return(updateMeasurementData api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { + _c.Call.Return(updateMeasurementData) return _c } -func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) RunAndReturn(run func(float64, *time.Time, *model.MeasurementValueStateType) api.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { +func (_c *MuMPCInterface_UpdateDataVoltagePhaseC_Call) RunAndReturn(run func(value float64, timestamp *time.Time, valueState *model.MeasurementValueStateType) api1.UpdateMeasurementData) *MuMPCInterface_UpdateDataVoltagePhaseC_Call { _c.Call.Return(run) return _c } -// UpdateUseCaseAvailability provides a mock function with given fields: available -func (_m *MuMPCInterface) UpdateUseCaseAvailability(available bool) { - _m.Called(available) +// UpdateUseCaseAvailability provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) UpdateUseCaseAvailability(available bool) { + _mock.Called(available) + return } // MuMPCInterface_UpdateUseCaseAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUseCaseAvailability' @@ -1540,7 +1823,13 @@ func (_e *MuMPCInterface_Expecter) UpdateUseCaseAvailability(available interface func (_c *MuMPCInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *MuMPCInterface_UpdateUseCaseAvailability_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + var arg0 bool + if args[0] != nil { + arg0 = args[0].(bool) + } + run( + arg0, + ) }) return _c } @@ -1550,14 +1839,14 @@ func (_c *MuMPCInterface_UpdateUseCaseAvailability_Call) Return() *MuMPCInterfac return _c } -func (_c *MuMPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *MuMPCInterface_UpdateUseCaseAvailability_Call { +func (_c *MuMPCInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(available bool)) *MuMPCInterface_UpdateUseCaseAvailability_Call { _c.Run(run) return _c } -// VoltagePerPhase provides a mock function with no fields -func (_m *MuMPCInterface) VoltagePerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { - ret := _m.Called() +// VoltagePerPhase provides a mock function for the type MuMPCInterface +func (_mock *MuMPCInterface) VoltagePerPhase() (map[model.ElectricalConnectionPhaseNameType]float64, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for VoltagePerPhase") @@ -1565,23 +1854,21 @@ func (_m *MuMPCInterface) VoltagePerPhase() (map[model.ElectricalConnectionPhase var r0 map[model.ElectricalConnectionPhaseNameType]float64 var r1 error - if rf, ok := ret.Get(0).(func() (map[model.ElectricalConnectionPhaseNameType]float64, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (map[model.ElectricalConnectionPhaseNameType]float64, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() map[model.ElectricalConnectionPhaseNameType]float64); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() map[model.ElectricalConnectionPhaseNameType]float64); ok { + r0 = returnFunc() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(map[model.ElectricalConnectionPhaseNameType]float64) } } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -1602,8 +1889,8 @@ func (_c *MuMPCInterface_VoltagePerPhase_Call) Run(run func()) *MuMPCInterface_V return _c } -func (_c *MuMPCInterface_VoltagePerPhase_Call) Return(_a0 map[model.ElectricalConnectionPhaseNameType]float64, _a1 error) *MuMPCInterface_VoltagePerPhase_Call { - _c.Call.Return(_a0, _a1) +func (_c *MuMPCInterface_VoltagePerPhase_Call) Return(electricalConnectionPhaseNameTypeToFloat64 map[model.ElectricalConnectionPhaseNameType]float64, err error) *MuMPCInterface_VoltagePerPhase_Call { + _c.Call.Return(electricalConnectionPhaseNameTypeToFloat64, err) return _c } @@ -1611,17 +1898,3 @@ func (_c *MuMPCInterface_VoltagePerPhase_Call) RunAndReturn(run func() (map[mode _c.Call.Return(run) return _c } - -// NewMuMPCInterface creates a new instance of MuMPCInterface. 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 NewMuMPCInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MuMPCInterface { - mock := &MuMPCInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/UpdateConfigurationData.go b/usecases/mocks/UpdateConfigurationData.go new file mode 100644 index 00000000..f3ec8472 --- /dev/null +++ b/usecases/mocks/UpdateConfigurationData.go @@ -0,0 +1,169 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "github.com/enbility/spine-go/model" + mock "github.com/stretchr/testify/mock" +) + +// NewUpdateConfigurationData creates a new instance of UpdateConfigurationData. 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 NewUpdateConfigurationData(t interface { + mock.TestingT + Cleanup(func()) +}) *UpdateConfigurationData { + mock := &UpdateConfigurationData{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// UpdateConfigurationData is an autogenerated mock type for the UpdateConfigurationData type +type UpdateConfigurationData struct { + mock.Mock +} + +type UpdateConfigurationData_Expecter struct { + mock *mock.Mock +} + +func (_m *UpdateConfigurationData) EXPECT() *UpdateConfigurationData_Expecter { + return &UpdateConfigurationData_Expecter{mock: &_m.Mock} +} + +// ConfigurationData provides a mock function for the type UpdateConfigurationData +func (_mock *UpdateConfigurationData) ConfigurationData() model.DeviceConfigurationKeyValueDataType { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for ConfigurationData") + } + + var r0 model.DeviceConfigurationKeyValueDataType + if returnFunc, ok := ret.Get(0).(func() model.DeviceConfigurationKeyValueDataType); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(model.DeviceConfigurationKeyValueDataType) + } + return r0 +} + +// UpdateConfigurationData_ConfigurationData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConfigurationData' +type UpdateConfigurationData_ConfigurationData_Call struct { + *mock.Call +} + +// ConfigurationData is a helper method to define mock.On call +func (_e *UpdateConfigurationData_Expecter) ConfigurationData() *UpdateConfigurationData_ConfigurationData_Call { + return &UpdateConfigurationData_ConfigurationData_Call{Call: _e.mock.On("ConfigurationData")} +} + +func (_c *UpdateConfigurationData_ConfigurationData_Call) Run(run func()) *UpdateConfigurationData_ConfigurationData_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *UpdateConfigurationData_ConfigurationData_Call) Return(deviceConfigurationKeyValueDataType model.DeviceConfigurationKeyValueDataType) *UpdateConfigurationData_ConfigurationData_Call { + _c.Call.Return(deviceConfigurationKeyValueDataType) + return _c +} + +func (_c *UpdateConfigurationData_ConfigurationData_Call) RunAndReturn(run func() model.DeviceConfigurationKeyValueDataType) *UpdateConfigurationData_ConfigurationData_Call { + _c.Call.Return(run) + return _c +} + +// NotSupportedError provides a mock function for the type UpdateConfigurationData +func (_mock *UpdateConfigurationData) NotSupportedError() error { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for NotSupportedError") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() + } else { + r0 = ret.Error(0) + } + return r0 +} + +// UpdateConfigurationData_NotSupportedError_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NotSupportedError' +type UpdateConfigurationData_NotSupportedError_Call struct { + *mock.Call +} + +// NotSupportedError is a helper method to define mock.On call +func (_e *UpdateConfigurationData_Expecter) NotSupportedError() *UpdateConfigurationData_NotSupportedError_Call { + return &UpdateConfigurationData_NotSupportedError_Call{Call: _e.mock.On("NotSupportedError")} +} + +func (_c *UpdateConfigurationData_NotSupportedError_Call) Run(run func()) *UpdateConfigurationData_NotSupportedError_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *UpdateConfigurationData_NotSupportedError_Call) Return(err error) *UpdateConfigurationData_NotSupportedError_Call { + _c.Call.Return(err) + return _c +} + +func (_c *UpdateConfigurationData_NotSupportedError_Call) RunAndReturn(run func() error) *UpdateConfigurationData_NotSupportedError_Call { + _c.Call.Return(run) + return _c +} + +// Supported provides a mock function for the type UpdateConfigurationData +func (_mock *UpdateConfigurationData) Supported() bool { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Supported") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// UpdateConfigurationData_Supported_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Supported' +type UpdateConfigurationData_Supported_Call struct { + *mock.Call +} + +// Supported is a helper method to define mock.On call +func (_e *UpdateConfigurationData_Expecter) Supported() *UpdateConfigurationData_Supported_Call { + return &UpdateConfigurationData_Supported_Call{Call: _e.mock.On("Supported")} +} + +func (_c *UpdateConfigurationData_Supported_Call) Run(run func()) *UpdateConfigurationData_Supported_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *UpdateConfigurationData_Supported_Call) Return(b bool) *UpdateConfigurationData_Supported_Call { + _c.Call.Return(b) + return _c +} + +func (_c *UpdateConfigurationData_Supported_Call) RunAndReturn(run func() bool) *UpdateConfigurationData_Supported_Call { + _c.Call.Return(run) + return _c +} diff --git a/usecases/mocks/UpdateData.go b/usecases/mocks/UpdateData.go index 089ea29e..126bcac6 100644 --- a/usecases/mocks/UpdateData.go +++ b/usecases/mocks/UpdateData.go @@ -1,8 +1,26 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks -import mock "github.com/stretchr/testify/mock" +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewUpdateData creates a new instance of UpdateData. 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 NewUpdateData(t interface { + mock.TestingT + Cleanup(func()) +}) *UpdateData { + mock := &UpdateData{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} // UpdateData is an autogenerated mock type for the UpdateData type type UpdateData struct { @@ -17,21 +35,20 @@ func (_m *UpdateData) EXPECT() *UpdateData_Expecter { return &UpdateData_Expecter{mock: &_m.Mock} } -// NotSupportedError provides a mock function with no fields -func (_m *UpdateData) NotSupportedError() error { - ret := _m.Called() +// NotSupportedError provides a mock function for the type UpdateData +func (_mock *UpdateData) NotSupportedError() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for NotSupportedError") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -52,8 +69,8 @@ func (_c *UpdateData_NotSupportedError_Call) Run(run func()) *UpdateData_NotSupp return _c } -func (_c *UpdateData_NotSupportedError_Call) Return(_a0 error) *UpdateData_NotSupportedError_Call { - _c.Call.Return(_a0) +func (_c *UpdateData_NotSupportedError_Call) Return(err error) *UpdateData_NotSupportedError_Call { + _c.Call.Return(err) return _c } @@ -62,21 +79,20 @@ func (_c *UpdateData_NotSupportedError_Call) RunAndReturn(run func() error) *Upd return _c } -// Supported provides a mock function with no fields -func (_m *UpdateData) Supported() bool { - ret := _m.Called() +// Supported provides a mock function for the type UpdateData +func (_mock *UpdateData) Supported() bool { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Supported") } var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -97,8 +113,8 @@ func (_c *UpdateData_Supported_Call) Run(run func()) *UpdateData_Supported_Call return _c } -func (_c *UpdateData_Supported_Call) Return(_a0 bool) *UpdateData_Supported_Call { - _c.Call.Return(_a0) +func (_c *UpdateData_Supported_Call) Return(b bool) *UpdateData_Supported_Call { + _c.Call.Return(b) return _c } @@ -106,17 +122,3 @@ func (_c *UpdateData_Supported_Call) RunAndReturn(run func() bool) *UpdateData_S _c.Call.Return(run) return _c } - -// NewUpdateData creates a new instance of UpdateData. 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 NewUpdateData(t interface { - mock.TestingT - Cleanup(func()) -}) *UpdateData { - mock := &UpdateData{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mocks/UpdateMeasurementData.go b/usecases/mocks/UpdateMeasurementData.go index 7185d141..cd750857 100644 --- a/usecases/mocks/UpdateMeasurementData.go +++ b/usecases/mocks/UpdateMeasurementData.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.4. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package mocks import ( - api "github.com/enbility/eebus-go/api" + "github.com/enbility/eebus-go/api" mock "github.com/stretchr/testify/mock" ) +// NewUpdateMeasurementData creates a new instance of UpdateMeasurementData. 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 NewUpdateMeasurementData(t interface { + mock.TestingT + Cleanup(func()) +}) *UpdateMeasurementData { + mock := &UpdateMeasurementData{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // UpdateMeasurementData is an autogenerated mock type for the UpdateMeasurementData type type UpdateMeasurementData struct { mock.Mock @@ -20,21 +36,20 @@ func (_m *UpdateMeasurementData) EXPECT() *UpdateMeasurementData_Expecter { return &UpdateMeasurementData_Expecter{mock: &_m.Mock} } -// MeasurementData provides a mock function with no fields -func (_m *UpdateMeasurementData) MeasurementData() api.MeasurementDataForID { - ret := _m.Called() +// MeasurementData provides a mock function for the type UpdateMeasurementData +func (_mock *UpdateMeasurementData) MeasurementData() api.MeasurementDataForID { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for MeasurementData") } var r0 api.MeasurementDataForID - if rf, ok := ret.Get(0).(func() api.MeasurementDataForID); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() api.MeasurementDataForID); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(api.MeasurementDataForID) } - return r0 } @@ -55,8 +70,8 @@ func (_c *UpdateMeasurementData_MeasurementData_Call) Run(run func()) *UpdateMea return _c } -func (_c *UpdateMeasurementData_MeasurementData_Call) Return(_a0 api.MeasurementDataForID) *UpdateMeasurementData_MeasurementData_Call { - _c.Call.Return(_a0) +func (_c *UpdateMeasurementData_MeasurementData_Call) Return(measurementDataForID api.MeasurementDataForID) *UpdateMeasurementData_MeasurementData_Call { + _c.Call.Return(measurementDataForID) return _c } @@ -65,21 +80,20 @@ func (_c *UpdateMeasurementData_MeasurementData_Call) RunAndReturn(run func() ap return _c } -// NotSupportedError provides a mock function with no fields -func (_m *UpdateMeasurementData) NotSupportedError() error { - ret := _m.Called() +// NotSupportedError provides a mock function for the type UpdateMeasurementData +func (_mock *UpdateMeasurementData) NotSupportedError() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for NotSupportedError") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -100,8 +114,8 @@ func (_c *UpdateMeasurementData_NotSupportedError_Call) Run(run func()) *UpdateM return _c } -func (_c *UpdateMeasurementData_NotSupportedError_Call) Return(_a0 error) *UpdateMeasurementData_NotSupportedError_Call { - _c.Call.Return(_a0) +func (_c *UpdateMeasurementData_NotSupportedError_Call) Return(err error) *UpdateMeasurementData_NotSupportedError_Call { + _c.Call.Return(err) return _c } @@ -110,21 +124,20 @@ func (_c *UpdateMeasurementData_NotSupportedError_Call) RunAndReturn(run func() return _c } -// Supported provides a mock function with no fields -func (_m *UpdateMeasurementData) Supported() bool { - ret := _m.Called() +// Supported provides a mock function for the type UpdateMeasurementData +func (_mock *UpdateMeasurementData) Supported() bool { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Supported") } var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() bool); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(bool) } - return r0 } @@ -145,8 +158,8 @@ func (_c *UpdateMeasurementData_Supported_Call) Run(run func()) *UpdateMeasureme return _c } -func (_c *UpdateMeasurementData_Supported_Call) Return(_a0 bool) *UpdateMeasurementData_Supported_Call { - _c.Call.Return(_a0) +func (_c *UpdateMeasurementData_Supported_Call) Return(b bool) *UpdateMeasurementData_Supported_Call { + _c.Call.Return(b) return _c } @@ -154,17 +167,3 @@ func (_c *UpdateMeasurementData_Supported_Call) RunAndReturn(run func() bool) *U _c.Call.Return(run) return _c } - -// NewUpdateMeasurementData creates a new instance of UpdateMeasurementData. 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 NewUpdateMeasurementData(t interface { - mock.TestingT - Cleanup(func()) -}) *UpdateMeasurementData { - mock := &UpdateMeasurementData{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/usecases/mu/mpc/testhelper_test.go b/usecases/mu/mpc/testhelper_test.go index 2e503215..a4aaa522 100644 --- a/usecases/mu/mpc/testhelper_test.go +++ b/usecases/mu/mpc/testhelper_test.go @@ -61,7 +61,7 @@ func (s *MuMPCSuite) BeforeTest(_, _ string) { []shipapi.DeviceCategoryType{shipapi.DeviceCategoryTypeEnergyManagementSystem}, model.DeviceTypeTypeEnergyManagementSystem, []model.EntityTypeType{model.EntityTypeTypeInverter}, - 9999, cert, time.Second*4) + 9999, cert, time.Second*4, nil, nil) serviceHandler := mocks.NewServiceReaderInterface(s.T()) serviceHandler.EXPECT().ServicePairingDetailUpdate(mock.Anything, mock.Anything).Return().Maybe() diff --git a/usecases/mu/mpc/usecase.go b/usecases/mu/mpc/usecase.go index b4ffdca2..e52937a0 100644 --- a/usecases/mu/mpc/usecase.go +++ b/usecases/mu/mpc/usecase.go @@ -9,7 +9,6 @@ import ( "github.com/enbility/eebus-go/usecases/usecase" spineapi "github.com/enbility/spine-go/api" "github.com/enbility/spine-go/model" - "github.com/enbility/spine-go/spine" "github.com/enbility/spine-go/util" ) @@ -141,7 +140,7 @@ func NewMPC( uc.acCurrentPerPhase = PhaseMeasurementIdMap{} uc.acVoltagePerPhase = PhaseMeasurementIdMap{} - _ = spine.Events.Subscribe(uc) + _ = localEntity.Device().Events().Subscribe(uc) return uc, nil } diff --git a/usecases/mu/mpc/usecase_test.go b/usecases/mu/mpc/usecase_test.go index 85df088e..3da87cd9 100644 --- a/usecases/mu/mpc/usecase_test.go +++ b/usecases/mu/mpc/usecase_test.go @@ -54,7 +54,7 @@ func (s *MuMpcUsecaseSuite) BeforeTest(_, _ string) { []shipapi.DeviceCategoryType{shipapi.DeviceCategoryTypeEnergyManagementSystem}, model.DeviceTypeTypeEnergyManagementSystem, []model.EntityTypeType{model.EntityTypeTypeInverter}, - 9999, cert, time.Second*4) + 9999, cert, time.Second*4, nil, nil) serviceHandler := mocks.NewServiceReaderInterface(s.T()) serviceHandler.EXPECT().ServicePairingDetailUpdate(mock.Anything, mock.Anything).Return().Maybe() From 90cfe367c3e08cf97c8aa10665b8b87e0f11ce87 Mon Sep 17 00:00:00 2001 From: Tom Luca Roth Date: Fri, 29 May 2026 15:45:22 +0200 Subject: [PATCH 59/61] fixed mgcp after rebase --- usecases/gcp/mgcp/testhelper_test.go | 2 +- usecases/gcp/mgcp/usecase.go | 3 +-- usecases/gcp/mgcp/usecase_test.go | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/usecases/gcp/mgcp/testhelper_test.go b/usecases/gcp/mgcp/testhelper_test.go index fc3cc5dc..36439a4d 100644 --- a/usecases/gcp/mgcp/testhelper_test.go +++ b/usecases/gcp/mgcp/testhelper_test.go @@ -54,7 +54,7 @@ func (s *GcpMpcgSuite) BeforeTest(suiteName, testName string) { []shipapi.DeviceCategoryType{shipapi.DeviceCategoryTypeGridConnectionHub}, model.DeviceTypeTypeEnergyManagementSystem, []model.EntityTypeType{model.EntityTypeTypeInverter}, - 9999, cert, time.Second*4) + 9999, cert, time.Second*4, nil, nil) serviceHandler := mocks.NewServiceReaderInterface(s.T()) serviceHandler.EXPECT().ServicePairingDetailUpdate(mock.Anything, mock.Anything).Return().Maybe() diff --git a/usecases/gcp/mgcp/usecase.go b/usecases/gcp/mgcp/usecase.go index 706ecfa4..9e1f0740 100644 --- a/usecases/gcp/mgcp/usecase.go +++ b/usecases/gcp/mgcp/usecase.go @@ -7,7 +7,6 @@ import ( "github.com/enbility/eebus-go/usecases/usecase" spineapi "github.com/enbility/spine-go/api" "github.com/enbility/spine-go/model" - "github.com/enbility/spine-go/spine" "github.com/enbility/spine-go/util" ) @@ -160,7 +159,7 @@ func NewMGCP( frequencyConfig: monitorFrequencyConfig, } - _ = spine.Events.Subscribe(uc) + _ = localEntity.Device().Events().Subscribe(uc) return uc, nil } diff --git a/usecases/gcp/mgcp/usecase_test.go b/usecases/gcp/mgcp/usecase_test.go index c3bdefd3..b77adff8 100644 --- a/usecases/gcp/mgcp/usecase_test.go +++ b/usecases/gcp/mgcp/usecase_test.go @@ -34,7 +34,7 @@ func (s *MgcpUsecaseSuite) BeforeTest(_, _ string) { []shipapi.DeviceCategoryType{shipapi.DeviceCategoryTypeEnergyManagementSystem}, model.DeviceTypeTypeEnergyManagementSystem, []model.EntityTypeType{model.EntityTypeTypeGridGuard}, - 9999, cert, time.Second*4) + 9999, cert, time.Second*4, nil, nil) serviceHandler := mocks.NewServiceReaderInterface(s.T()) serviceHandler.EXPECT().ServicePairingDetailUpdate(mock.Anything, mock.Anything).Return().Maybe() From 53700663e163d07c5d12665f2d78bd1ce6fc3c17 Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Tue, 9 Jun 2026 10:15:01 +0200 Subject: [PATCH 60/61] Clear warning in mgcp use case. Breaks were always intended for switch not loop, but go switches don't fallthrough by default. --- usecases/gcp/mgcp/public.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/usecases/gcp/mgcp/public.go b/usecases/gcp/mgcp/public.go index e0053614..75ceb992 100644 --- a/usecases/gcp/mgcp/public.go +++ b/usecases/gcp/mgcp/public.go @@ -155,10 +155,8 @@ func (m *MGCP) Update(updateValueType ...usecaseapi.UpdateData) error { switch update.(type) { case usecaseapi.UpdateMeasurementData: measurements = append(measurements, update.(usecaseapi.UpdateMeasurementData).MeasurementData()) - break case usecaseapi.UpdateConfigurationData: configurations = append(configurations, update.(usecaseapi.UpdateConfigurationData).ConfigurationData()) - break default: return errors.New("unsupported updateValueType") } From 4aad63b72421466474b680d507c5c60ae1c81b29 Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Tue, 9 Jun 2026 10:27:40 +0200 Subject: [PATCH 61/61] Fix MPC/MGCP tests --- usecases/gcp/mgcp/usecase_test.go | 14 ++++++------- usecases/mu/mpc/usecase_test.go | 35 ++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/usecases/gcp/mgcp/usecase_test.go b/usecases/gcp/mgcp/usecase_test.go index b77adff8..b245b76a 100644 --- a/usecases/gcp/mgcp/usecase_test.go +++ b/usecases/gcp/mgcp/usecase_test.go @@ -262,7 +262,7 @@ func (s *GcpMpcgSuite) Test_AddFeaturesElectricalConnectionNilError() { } func (s *MgcpUsecaseSuite) Test_configurePvFeedInLimitationFactorError() { - localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard) mgcp, err := NewMGCP( localEntity, @@ -307,7 +307,7 @@ func (s *MgcpUsecaseSuite) Test_configurePvFeedInLimitationFactorError() { } func (s *MgcpUsecaseSuite) Test_configureMonitorPowerError() { - localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard) mgcp, err := NewMGCP( localEntity, @@ -370,7 +370,7 @@ func (s *MgcpUsecaseSuite) Test_configureMonitorPowerError() { } func (s *MgcpUsecaseSuite) Test_configureGridFeedInError() { - localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard) mgcp, err := NewMGCP( localEntity, @@ -433,7 +433,7 @@ func (s *MgcpUsecaseSuite) Test_configureGridFeedInError() { } func (s *MgcpUsecaseSuite) Test_configureGridConsumptionError() { - localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard) mgcp, err := NewMGCP( localEntity, @@ -496,7 +496,7 @@ func (s *MgcpUsecaseSuite) Test_configureGridConsumptionError() { } func (s *MgcpUsecaseSuite) Test_configureMonitorCurrentError() { - localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard) mgcp, err := NewMGCP( localEntity, @@ -561,7 +561,7 @@ func (s *MgcpUsecaseSuite) Test_configureMonitorCurrentError() { } func (s *MgcpUsecaseSuite) Test_configureMonitorVoltageError() { - localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard) mgcp, err := NewMGCP( localEntity, @@ -635,7 +635,7 @@ func (s *MgcpUsecaseSuite) Test_configureMonitorVoltageError() { } func (s *MgcpUsecaseSuite) Test_configureMonitorFrequencyError() { - localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) + localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard) mgcp, err := NewMGCP( localEntity, diff --git a/usecases/mu/mpc/usecase_test.go b/usecases/mu/mpc/usecase_test.go index 3da87cd9..1123c3cb 100644 --- a/usecases/mu/mpc/usecase_test.go +++ b/usecases/mu/mpc/usecase_test.go @@ -75,6 +75,8 @@ func (s *MuMpcUsecaseSuite) BeforeTest(_, _ string) { s.mockedRemoteFeature.EXPECT().DataCopy(mock.Anything).Return(mock.Anything).Maybe() s.mockedRemoteFeature.EXPECT().Address().Return(&model.FeatureAddressType{}).Maybe() s.mockedRemoteFeature.EXPECT().Operations().Return(nil).Maybe() + + s.localEntity = s.service.LocalDevice().EntityForType(model.EntityTypeTypeInverter) } func (s *MuMpcUsecaseSuite) Test_MpcOptionalParameters() { @@ -285,7 +287,11 @@ func (s *MuMpcAbcSuite) Test_AddFeatures_NewElectricalConnectionError() { func (s *MuMpcUsecaseSuite) Test_configureMonitorPower() { localEntity := spineMocks.NewEntityLocalInterface(s.T()) - localEntity.EXPECT().Device().Return(nil) + mockedDevice := spineMocks.NewDeviceLocalInterface(s.T()) + mockedEvents := spineMocks.NewEventsManagerInterface(s.T()) + mockedEvents.EXPECT().Subscribe(mock.Anything).Return(nil).Maybe() + mockedDevice.EXPECT().Events().Return(mockedEvents).Maybe() + localEntity.EXPECT().Device().Return(mockedDevice) anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) @@ -359,7 +365,11 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorPower() { func (s *MuMpcUsecaseSuite) Test_configureMonitorEnergy() { localEntity := spineMocks.NewEntityLocalInterface(s.T()) - localEntity.EXPECT().Device().Return(nil) + mockedDevice := spineMocks.NewDeviceLocalInterface(s.T()) + mockedEvents := spineMocks.NewEventsManagerInterface(s.T()) + mockedEvents.EXPECT().Subscribe(mock.Anything).Return(nil).Maybe() + mockedDevice.EXPECT().Events().Return(mockedEvents).Maybe() + localEntity.EXPECT().Device().Return(mockedDevice) anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) @@ -427,7 +437,11 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorEnergy() { func (s *MuMpcUsecaseSuite) Test_configureMonitorCurrent() { localEntity := spineMocks.NewEntityLocalInterface(s.T()) - localEntity.EXPECT().Device().Return(nil) + mockedDevice := spineMocks.NewDeviceLocalInterface(s.T()) + mockedEvents := spineMocks.NewEventsManagerInterface(s.T()) + mockedEvents.EXPECT().Subscribe(mock.Anything).Return(nil).Maybe() + mockedDevice.EXPECT().Events().Return(mockedEvents).Maybe() + localEntity.EXPECT().Device().Return(mockedDevice) anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil).Maybe() @@ -513,7 +527,11 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorCurrent() { func (s *MuMpcUsecaseSuite) Test_configureMonitorVoltage() { localEntity := spineMocks.NewEntityLocalInterface(s.T()) - localEntity.EXPECT().Device().Return(nil) + mockedDevice := spineMocks.NewDeviceLocalInterface(s.T()) + mockedEvents := spineMocks.NewEventsManagerInterface(s.T()) + mockedEvents.EXPECT().Subscribe(mock.Anything).Return(nil).Maybe() + mockedDevice.EXPECT().Events().Return(mockedEvents).Maybe() + localEntity.EXPECT().Device().Return(mockedDevice) anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil).Maybe() @@ -588,7 +606,11 @@ func (s *MuMpcUsecaseSuite) Test_configureMonitorVoltage() { func (s *MuMpcUsecaseSuite) Test_configureMonitorFrequency() { localEntity := spineMocks.NewEntityLocalInterface(s.T()) - localEntity.EXPECT().Device().Return(nil) + mockedDevice := spineMocks.NewDeviceLocalInterface(s.T()) + mockedEvents := spineMocks.NewEventsManagerInterface(s.T()) + mockedEvents.EXPECT().Subscribe(mock.Anything).Return(nil).Maybe() + mockedDevice.EXPECT().Events().Return(mockedEvents).Maybe() + localEntity.EXPECT().Device().Return(mockedDevice) anyFeature := spineMocks.NewFeatureLocalInterface(s.T()) anyFeature.EXPECT().DataCopy(mock.Anything).Return(nil) @@ -660,6 +682,9 @@ func (s *MuMpcUsecaseSuite) TestAddFeatures() { s.mockedLocalFeature = spineMocks.NewFeatureLocalInterface(s.T()) s.mockedLocalEntity.EXPECT().GetOrAddFeature(mock.Anything, mock.Anything).Return(s.mockedLocalFeature).Maybe() s.mockedLocalEntity.EXPECT().Device().Return(s.mockedLocalDevice).Maybe() + mockedEvents := spineMocks.NewEventsManagerInterface(s.T()) + mockedEvents.EXPECT().Subscribe(mock.Anything).Return(nil).Maybe() + s.mockedLocalDevice.EXPECT().Events().Return(mockedEvents).Maybe() s.mockedLocalFeature.EXPECT().AddFunctionType(mock.Anything, mock.Anything, mock.Anything).Return().Maybe() s.mockedLocalEntity.EXPECT().FeatureOfTypeAndRole(model.FeatureTypeTypeMeasurement, model.RoleTypeServer).Return(nil).Once().Maybe()