Skip to content

Commit b76cb33

Browse files
committed
Update dependencies
- Update dependencies (SHIP, SPINE, …) - This also requires an update to Go 1.24.1 - Update mocks (using mockery 1.35) - Adopt SPINE API updates - Update binding and subscription tests
1 parent 8c97bb4 commit b76cb33

File tree

89 files changed

+6932
-5237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+6932
-5237
lines changed

.mockery.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
with-expecter: True
1+
# .mockery.yaml
22
inpackage: false
33
dir: "{{ .InterfaceDir }}/../mocks"
4-
mockname: "{{.InterfaceName}}"
5-
outpkg: "mocks"
4+
structname: "{{.InterfaceName}}"
5+
pkgname: "mocks"
66
filename: "{{.InterfaceName}}.go"
7-
all: True
7+
all: true
8+
template: testify
89
packages:
910
github.com/enbility/eebus-go/api:
10-
github.com/enbility/eebus-go/usecases/api:
11+
github.com/enbility/eebus-go/usecases/api:

api/api.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,17 @@ type ServiceInterface interface {
6262
// Returns the Service detail of a remote SKI
6363
RemoteServiceForSKI(ski string) *shipapi.ServiceDetails
6464

65-
// Sets the SKI as being paired
66-
RegisterRemoteSKI(ski string)
65+
// Pair a remote service based on the SKI
66+
//
67+
// Parameters:
68+
// - ski: the SKI of the remote service (required)
69+
// - shipID: the SHIP ID of the remote service (optional)
70+
//
71+
// Note: The SHIP ID is optional, but should be provided if available.
72+
// if provided, it will be used to validate the remote service is
73+
// providing this SHIP ID during the handshake process and will reject
74+
// the connection if it does not match.
75+
RegisterRemoteSKI(ski, shipID string)
6776

6877
// Sets the SKI as not being paired
6978
UnregisterRemoteSKI(ski string)

examples/ced/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (h *controlbox) run() {
110110
os.Exit(0)
111111
}
112112

113-
h.myService.RegisterRemoteSKI(remoteSki)
113+
h.myService.RegisterRemoteSKI(remoteSki, "")
114114

115115
h.myService.Start()
116116
// defer h.myService.Shutdown()

examples/controlbox/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (h *controlbox) run() {
104104
os.Exit(0)
105105
}
106106

107-
h.myService.RegisterRemoteSKI(remoteSki)
107+
h.myService.RegisterRemoteSKI(remoteSki, "")
108108

109109
h.myService.Start()
110110
// defer h.myService.Shutdown()

examples/evse/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (h *evse) run() {
108108
os.Exit(0)
109109
}
110110

111-
h.myService.RegisterRemoteSKI(remoteSki)
111+
h.myService.RegisterRemoteSKI(remoteSki, "")
112112

113113
h.myService.Start()
114114
// defer h.myService.Shutdown()

examples/heatpump/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (h *heatpump) run() {
9494
h.AddFeatures()
9595
_ = spine.Events.Subscribe(h)
9696

97-
h.myService.RegisterRemoteSKI(remoteSki)
97+
h.myService.RegisterRemoteSKI(remoteSki, "")
9898

9999
h.myService.Start()
100100
// defer h.myService.Shutdown()

examples/hems/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func (h *hems) run() {
139139
os.Exit(0)
140140
}
141141

142-
h.myService.RegisterRemoteSKI(remoteSki)
142+
h.myService.RegisterRemoteSKI(remoteSki, "")
143143

144144
h.myService.Start()
145145
// defer h.myService.Shutdown()

features/client/feature_test.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,49 +90,55 @@ func (s *FeatureSuite) Test_NewFeature() {
9090
}
9191

9292
func (s *FeatureSuite) Test_Subscription() {
93+
// Test initial state
9394
subscription := s.testFeature.HasSubscription()
9495
assert.Equal(s.T(), false, subscription)
9596

97+
// Test subscribe request - verify it returns without error
9698
counter, err := s.testFeature.Subscribe()
9799
assert.Nil(s.T(), err)
98100
assert.NotNil(s.T(), counter)
99101

100-
subscription = s.testFeature.HasSubscription()
101-
assert.Equal(s.T(), true, subscription)
102+
// Note: In a real EEBUS environment, subscription requires remote device approval.
103+
// Since we're testing with mock devices that don't process approval,
104+
// HasSubscription() will remain false. This is expected behavior.
105+
// The important test is that Subscribe() method works without error.
102106

103-
counter, err = s.testFeature.Subscribe()
104-
assert.NotNil(s.T(), counter)
107+
// Test duplicate subscribe request
108+
counter2, err := s.testFeature.Subscribe()
109+
assert.NotNil(s.T(), counter2)
105110
assert.Nil(s.T(), err)
106111

112+
// Test unsubscribe - should work even if subscription wasn't confirmed
107113
counter, err = s.testFeature.Unsubscribe()
108114
assert.NotNil(s.T(), counter)
109115
assert.Nil(s.T(), err)
110-
111-
subscription = s.testFeature.HasSubscription()
112-
assert.Equal(s.T(), false, subscription)
113116
}
114117

115118
func (s *FeatureSuite) Test_Binding() {
119+
// Test initial state
116120
binding := s.testFeature.HasBinding()
117121
assert.Equal(s.T(), false, binding)
118122

123+
// Test bind request - verify it returns without error
119124
counter, err := s.testFeature.Bind()
120125
assert.Nil(s.T(), err)
121126
assert.NotNil(s.T(), counter)
122127

123-
binding = s.testFeature.HasBinding()
124-
assert.Equal(s.T(), true, binding)
128+
// Note: In a real EEBUS environment, binding requires remote device approval.
129+
// Since we're testing with mock devices that don't process approval,
130+
// HasBinding() will remain false. This is expected behavior.
131+
// The important test is that Bind() method works without error.
125132

126-
counter, err = s.testFeature.Bind()
127-
assert.NotNil(s.T(), counter)
133+
// Test duplicate bind request
134+
counter2, err := s.testFeature.Bind()
135+
assert.NotNil(s.T(), counter2)
128136
assert.Nil(s.T(), err)
129137

138+
// Test unbind - should work even if binding wasn't confirmed
130139
counter, err = s.testFeature.Unbind()
131140
assert.NotNil(s.T(), counter)
132141
assert.Nil(s.T(), err)
133-
134-
binding = s.testFeature.HasBinding()
135-
assert.Equal(s.T(), false, binding)
136142
}
137143

138144
func (s *FeatureSuite) Test_ResultCallback() {

features/client/helper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func setupFeatures(
177177
}
178178
data.FeatureInformation = features
179179

180-
remoteEntities, err := remoteDevice.AddEntityAndFeatures(true, data)
180+
remoteEntities, err := remoteDevice.AddEntityAndFeatures(true, data, nil)
181181
assert.Nil(t, err)
182182
assert.NotNil(t, remoteEntities)
183183
assert.NotEqual(t, 0, len(remoteEntities))

features/internal/helper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func setupFeatures(
172172
}
173173
data.FeatureInformation = features
174174

175-
remoteEntities, err := remoteDevice.AddEntityAndFeatures(true, data)
175+
remoteEntities, err := remoteDevice.AddEntityAndFeatures(true, data, nil)
176176
assert.Nil(t, err)
177177
assert.NotNil(t, remoteEntities)
178178
assert.NotEqual(t, 0, len(remoteEntities))

0 commit comments

Comments
 (0)