cantabile_edge, cantabile_modbus, cantabile_eebus 0.1.2148: EEBUS bridge 0.1.2 (connection and grid-limit fixes); full source

This commit is contained in:
Setti Solutions S.R.L committed 2026-11-13 23:39:25 +00:00
1 parent b3dfc9bb68
commit 87e4a42274
387 files changed
+66777 -81

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ Settings → Add-ons → Add-on store → ⋮ → Repositories, add
`https://git.setti.solutions/Daniel/cantabile-ha-addons`, then install the `https://git.setti.solutions/Daniel/cantabile-ha-addons`, then install the
add-on. The Supervisor pulls the prebuilt images add-on. The Supervisor pulls the prebuilt images
(`git.setti.solutions/daniel/cantabile-ha-<edge|modbus|eebus>-<arch>:<version>`, (`git.setti.solutions/daniel/cantabile-ha-<edge|modbus|eebus>-<arch>:<version>`,
named by `image:` in each `config.yaml`); this version: `0.1.2080`, arch amd64. named by `image:` in each `config.yaml`); this version: `0.1.2148`, arch amd64.
## Layout ## Layout
+1 -1
View File
@@ -3,7 +3,7 @@
# the Hub's, wrapped by addon-run (Dockerfile). The image is prebuilt, # the Hub's, wrapped by addon-run (Dockerfile). The image is prebuilt,
# per arch (README.md: building it from src/). # per arch (README.md: building it from src/).
name: Cantabile Edge Agent name: Cantabile Edge Agent
version: "0.1.2080" version: "0.1.2148"
slug: cantabile_edge slug: cantabile_edge
description: Plans your home's energy with Cantabile and, with your consent, runs the devices you choose. description: Plans your home's energy with Cantabile and, with your consent, runs the devices you choose.
url: https://cantabile.cloud url: https://cantabile.cloud
+11
View File
@@ -2,6 +2,17 @@
## Unreleased ## Unreleased
- No more crashes or hangs on reconnects: a device that connects twice,
or drops off in the middle of pairing, no longer crashes the add-on; a
lock-up under load is fixed. An unexpected error ends only that one
device's connection; the others carry on.
- A heat pump or wallbox that loses the grid operator's limit (it reports
another limit than the one passed on) gets it again.
- A device back online gets the current limit at once.
- The grid operator's control box is never disconnected over the
add-on's own errors.
- A binding a device refused is asked for again, waiting longer each time
(30 s up to 10 min), so control resumes without a restart.
- Declares to the grid operator's control box only what is known: the - Declares to the grid operator's control box only what is known: the
heat pumps' and wallboxes' reported power, else the rating you enter on heat pumps' and wallboxes' reported power, else the rating you enter on
a device's page. Unknown: nothing is declared and the grid operator's a device's page. Unknown: nothing is declared and the grid operator's
+1
View File
@@ -7,6 +7,7 @@
FROM docker.io/library/golang:1.26.9-bookworm AS build FROM docker.io/library/golang:1.26.9-bookworm AS build
WORKDIR /src WORKDIR /src
COPY src/eebus-bridge/go.mod src/eebus-bridge/go.sum ./ COPY src/eebus-bridge/go.mod src/eebus-bridge/go.sum ./
COPY src/eebus-bridge/third_party ./third_party
RUN go mod download RUN go mod download
COPY src/eebus-bridge/*.go ./ COPY src/eebus-bridge/*.go ./
ARG VERSION=0.0.0-dev ARG VERSION=0.0.0-dev
+1 -1
View File
@@ -4,7 +4,7 @@
# Assistant that isn't a Cantabile Hub. Devices are paired on its page # Assistant that isn't a Cantabile Hub. Devices are paired on its page
# (ingress), by their SKI. # (ingress), by their SKI.
name: Cantabile EEBUS name: Cantabile EEBUS
version: "0.1.2080" version: "0.1.2148"
slug: cantabile_eebus slug: cantabile_eebus
description: Pairs with EEBUS devices (the grid operator's control box, heat pumps, wallboxes, inverters), shows them in Home Assistant under Cantabile's names and hands the grid operator's §14a limit to the Cantabile agent; every control with its protection. description: Pairs with EEBUS devices (the grid operator's control box, heat pumps, wallboxes, inverters), shows them in Home Assistant under Cantabile's names and hands the grid operator's §14a limit to the Cantabile agent; every control with its protection.
url: https://cantabile.cloud url: https://cantabile.cloud
+1 -1
View File
@@ -4,7 +4,7 @@
# Home Assistant that isn't a Cantabile Hub. Devices come from the options; # Home Assistant that isn't a Cantabile Hub. Devices come from the options;
# the page (ingress) shows them and each control's protection. # the page (ingress) shows them and each control's protection.
name: Cantabile Modbus bridge name: Cantabile Modbus bridge
version: "0.1.2080" version: "0.1.2148"
slug: cantabile_modbus slug: cantabile_modbus
description: Reads inverters, meters, relays and circuits by Cantabile's device profiles (Modbus, or Home Assistant's own entities) and shows them in Home Assistant, each control with its protection. description: Reads inverters, meters, relays and circuits by Cantabile's device profiles (Modbus, or Home Assistant's own entities) and shows them in Home Assistant, each control with its protection.
url: https://cantabile.cloud url: https://cantabile.cloud
+4 -4
View File
@@ -1,15 +1,15 @@
# Third-party notices: Cantabile EEBUS bridge # Third-party notices: Cantabile EEBUS bridge
Copyright © 2026 Setti Solutions S.R.L, www.setti.md. The Cantabile EEBUS bridge links the open-source Go modules below (go list -deps of the bridge; regenerate with notices.sh). Their licences permit use, modification and redistribution in binary form when these notices are included. Copyright © 2026 Setti Solutions S.R.L, www.setti.md. The Cantabile EEBUS bridge links the open-source Go modules below (go list -deps of the bridge; regenerate with notices.sh). Their licences permit use, modification and redistribution in binary form when these notices are included. Modules marked patched are built from a modified copy in third_party/ (its PATCHES.md lists the changes, published under the module's own licence).
| Module | Version | Licence | | Module | Version | Licence |
|---|---|---| |---|---|---|
| github.com/ahmetb/go-linq/v3 | v3.2.0 | Apache-2.0 | | github.com/ahmetb/go-linq/v3 | v3.2.0 | Apache-2.0 |
| github.com/eclipse/paho.mqtt.golang | v1.5.0 | EPL-2.0 or EDL-1.0 (BSD-3-Clause); used under EDL-1.0 | | github.com/eclipse/paho.mqtt.golang | v1.5.0 | EPL-2.0 or EDL-1.0 (BSD-3-Clause); used under EDL-1.0 |
| github.com/enbility/eebus-go | v0.7.0 | MIT | | github.com/enbility/eebus-go | v0.7.0, patched (third_party/eebus-go) | MIT |
| github.com/enbility/go-avahi | v0.0.0-20240909195612-d5de6b280d7a | MIT | | github.com/enbility/go-avahi | v0.0.0-20240909195612-d5de6b280d7a | MIT |
| github.com/enbility/ship-go | v0.6.0 | MIT | | github.com/enbility/ship-go | v0.6.0, patched (third_party/ship-go) | MIT |
| github.com/enbility/spine-go | v0.7.0 | MIT | | github.com/enbility/spine-go | v0.7.0, patched (third_party/spine-go) | MIT |
| github.com/enbility/zeroconf/v2 | v2.0.0-20240920094356-be1cae74fda6 | MIT | | github.com/enbility/zeroconf/v2 | v2.0.0-20240920094356-be1cae74fda6 | MIT |
| github.com/godbus/dbus/v5 | v5.1.0 | BSD-2-Clause | | github.com/godbus/dbus/v5 | v5.1.0 | BSD-2-Clause |
| github.com/golanguzb70/lrucache | v1.2.0 | MIT | | github.com/golanguzb70/lrucache | v1.2.0 | MIT |
+201 -18
View File
@@ -6,10 +6,12 @@ import (
"errors" "errors"
"fmt" "fmt"
"log" "log"
"math"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"sync/atomic"
"time" "time"
) )
@@ -46,6 +48,11 @@ type Options struct {
// LPC timings (the use case's: failsafe after 120 s without the control // LPC timings (the use case's: failsafe after 120 s without the control
// box's heartbeat) // box's heartbeat)
HeartbeatGrace time.Duration HeartbeatGrace time.Duration
// the check of a limit passed on (checkPassedOn): the tolerance of a
// reported limit, and the longest wait between attempts to write it
// again (defaults: DefaultPassOnToleranceW, DefaultPassOnRetryMax)
PassOnToleranceW float64
PassOnRetryMax time.Duration
} }
// Grid is the grid operator's limit as the bridge holds it (LPC, the // Grid is the grid operator's limit as the bridge holds it (LPC, the
@@ -90,6 +97,8 @@ type Core struct {
// goroutine (the grid link takes its own lock, then this core's). // goroutine (the grid link takes its own lock, then this core's).
OnNominal func(w float64) OnNominal func(w float64)
lastNominal float64 lastNominal float64
resends map[string]resend // by SKI: limits written again (checkPassedOn)
cbSKI atomic.Value // the control box's SKI, string (noteControlBox)
} }
func NewCore(opts Options, store *Store, backend Backend, profiles map[string]*Profile, signer *Signer) *Core { func NewCore(opts Options, store *Store, backend Backend, profiles map[string]*Profile, signer *Signer) *Core {
@@ -105,8 +114,15 @@ func NewCore(opts Options, store *Store, backend Backend, profiles map[string]*P
if opts.HeartbeatGrace == 0 { if opts.HeartbeatGrace == 0 {
opts.HeartbeatGrace = 120 * time.Second opts.HeartbeatGrace = 120 * time.Second
} }
if opts.PassOnToleranceW == 0 {
opts.PassOnToleranceW = DefaultPassOnToleranceW
}
if opts.PassOnRetryMax == 0 {
opts.PassOnRetryMax = DefaultPassOnRetryMax
}
c := &Core{opts: opts, store: store, backend: backend, profiles: profiles, signer: signer, c := &Core{opts: opts, store: store, backend: backend, profiles: profiles, signer: signer,
devices: map[string]*Device{}, now: time.Now, sent: map[string]string{}, pub: func(string, string, bool) {}} devices: map[string]*Device{}, now: time.Now, sent: map[string]string{}, pub: func(string, string, bool) {},
resends: map[string]resend{}}
for ski, d := range store.Devices { for ski, d := range store.Devices {
d.SKI = ski d.SKI = ski
d.State = "offline" d.State = "offline"
@@ -114,9 +130,27 @@ func NewCore(opts Options, store *Store, backend Backend, profiles map[string]*P
} }
c.grid.State = "normal" c.grid.State = "normal"
c.started = c.now() c.started = c.now()
c.noteControlBox()
return c return c
} }
// noteControlBox: the paired control box's SKI ("" none) for readers that
// must not wait for the core's lock (ControlBoxSKINow), under c.mu.
func (c *Core) noteControlBox() {
ski := ""
if d := c.controlBox(); d != nil {
ski = d.SKI
}
c.cbSKI.Store(ski)
}
// ControlBoxSKINow: the paired control box's SKI, lock-free (as of the
// last change of pairings or kinds; cleared on unpairing).
func (c *Core) ControlBoxSKINow() string {
s, _ := c.cbSKI.Load().(string)
return s
}
func (c *Core) event(format string, a ...any) { func (c *Core) event(format string, a ...any) {
msg := fmt.Sprintf(format, a...) msg := fmt.Sprintf(format, a...)
log.Print(msg) log.Print(msg)
@@ -180,13 +214,28 @@ func (c *Core) Connected(ski string, up bool) {
if d == nil || !d.Paired { if d == nil || !d.Paired {
return return
} }
// a report of the state it is in changes nothing (the library may report
// a connection twice): no event, no evaluation, no change to the
// back-off of a limit written again
state := "offline"
if up { if up {
d.State = "online" state = "online"
} else { }
d.State = "offline" if d.State == state {
if d.Kind == KindControlBox { return
}
d.State = state
if !up && d.Kind == KindControlBox {
d.set("heartbeat", false) d.set("heartbeat", false)
} }
if up {
// back after being away (§14a): the grid limit is due at once, on
// the next check; the attempt count stays, so a device that
// refuses it again backs off further
if r, ok := c.resends[d.SKI]; ok {
r.next = c.now()
c.resends[d.SKI] = r
}
} }
c.event("%s %s", d.Name, d.State) c.event("%s %s", d.Name, d.State)
c.publishStatus(d) c.publishStatus(d)
@@ -264,10 +313,92 @@ func (c *Core) Update(ski string, useCases []string, values map[string]any) {
c.publishValues(d) c.publishValues(d)
if d.Kind == KindControlBox { if d.Kind == KindControlBox {
c.evaluateGrid() c.evaluateGrid()
} else {
c.checkPassedOn(d)
} }
c.nominalChanged() // a heat pump's nominal_max, a wallbox's current_max or phases came c.nominalChanged() // a heat pump's nominal_max, a wallbox's current_max or phases came
} }
// checkPassedOn: a device that reports another limit than the grid limit
// passed on to it gets it again. A write can be lost without an error: it
// went to the device's connection that SHIP replaced a moment later (both
// sides connecting at once), or the device restarted.
func (c *Core) checkPassedOn(d *Device) {
if !c.opts.PassOn || !c.grid.Active() || d.State != "online" || !d.Available["limit"] || c.dry(d) != "" {
return
}
want, ok := d.Applied["limit"]
if !ok {
return
}
got, known := d.Number("limit")
active, _ := d.Values["limit_active"].(bool)
r, backingOff := c.resends[d.SKI]
if known && active && math.Abs(got-want) <= c.opts.PassOnToleranceW {
delete(c.resends, d.SKI) // holds it (again): the back-off starts over
return
}
now := c.now()
if backingOff && r.want == want && now.Before(r.next) {
return // backing off: the device refused or lost it again
}
if !backingOff || r.want != want {
r = resend{want: want} // a new target (0 W too)
}
wait := PassOnRetryFirst << r.n
if wait > c.opts.PassOnRetryMax || wait <= 0 {
wait = c.opts.PassOnRetryMax
}
r.n++
r.next = now.Add(wait)
c.resends[d.SKI] = r
if err := c.backend.WriteLimit(d, want, true); err != nil {
c.event("%s: passing the grid limit on again failed: %v", d.Name, err)
return
}
c.event("%s reports a limit of %v (active %v): the grid limit %.0f W passed on again (attempt %d, next check after %s)",
d.Name, d.Values["limit"], active, want, r.n, wait)
}
// resend: a device's grid limit written again (checkPassedOn), with its
// back-off: PassOnRetryFirst, doubling up to Options.PassOnRetryMax.
type resend struct {
want float64
n int
next time.Time
}
// The defaults of the pass-on check (docs/parameters.md E9b; the bridge has
// no Parameters source of its own: Options, set by the env of the same name
// in upper case).
const (
// a reported limit within this of the one passed on holds it (devices
// round: 4166.67 W reported as 4167 W)
DefaultPassOnToleranceW = 50.0
// the first wait after writing a limit again, doubling with each attempt
PassOnRetryFirst = 5 * time.Second
// the longest wait between two attempts
DefaultPassOnRetryMax = 5 * time.Minute
)
// PassedOnSKIs: the devices holding a grid limit passed on now (the bridge
// reads them regularly, so checkPassedOn sees a lost write).
func (c *Core) PassedOnSKIs() []string {
c.mu.Lock()
defer c.mu.Unlock()
out := []string{}
if !c.grid.Active() {
return out
}
for _, d := range c.devices {
if _, ok := d.Applied["limit"]; ok && d.State == "online" {
out = append(out, d.SKI)
}
}
sort.Strings(out)
return out
}
// -- the owner's actions (the page) ------------------------------------------ // -- the owner's actions (the page) ------------------------------------------
var ErrRefused = errors.New("refused") var ErrRefused = errors.New("refused")
@@ -284,15 +415,17 @@ func (c *Core) device(id string) *Device {
// Pair: the owner trusts this SKI (after comparing it with the device's // Pair: the owner trusts this SKI (after comparing it with the device's
// own display or label). // own display or label).
func (c *Core) Pair(ski, who string) error { func (c *Core) Pair(ski, who string) error {
// the core's part under its lock, unlocked deferred (a panic must not
// leave it held); the backend outside it
d, err := func() (*Device, error) {
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock()
d := c.devices[strings.ToLower(ski)] d := c.devices[strings.ToLower(ski)]
if d == nil { if d == nil {
c.mu.Unlock() return nil, fmt.Errorf("no device with SKI %s", ski)
return fmt.Errorf("no device with SKI %s", ski)
} }
if d.Paired { if d.Paired {
c.mu.Unlock() return nil, nil
return nil
} }
d.Paired, d.PairedAt, d.PairedBy = true, c.now().Unix(), who d.Paired, d.PairedAt, d.PairedBy = true, c.now().Unix(), who
if d.Kind == "" { if d.Kind == "" {
@@ -307,37 +440,46 @@ func (c *Core) Pair(ski, who string) error {
c.save() c.save()
c.audit("paired %s (%s %s, SKI %s) by %s", d.Name, d.Brand, d.Model, d.SKI, who) c.audit("paired %s (%s %s, SKI %s) by %s", d.Name, d.Brand, d.Model, d.SKI, who)
c.nominalChanged() c.nominalChanged()
c.mu.Unlock() return d, nil
}()
if err != nil || d == nil {
return err
}
return c.backend.Pair(d.SKI, d.Kind) return c.backend.Pair(d.SKI, d.Kind)
} }
// Deny: the owner refuses a pairing request. // Deny: the owner refuses a pairing request.
func (c *Core) Deny(ski, who string) error { func (c *Core) Deny(ski, who string) error {
err := func() error {
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock()
d := c.devices[strings.ToLower(ski)] d := c.devices[strings.ToLower(ski)]
if d == nil || d.Paired { if d == nil || d.Paired {
c.mu.Unlock()
return fmt.Errorf("no pairing request from %s", ski) return fmt.Errorf("no pairing request from %s", ski)
} }
d.State = "denied" d.State = "denied"
c.audit("denied pairing with %s (SKI %s) by %s", d.Name, d.SKI, who) c.audit("denied pairing with %s (SKI %s) by %s", d.Name, d.SKI, who)
c.mu.Unlock() return nil
}()
if err != nil {
return err
}
return c.backend.Deny(ski) return c.backend.Deny(ski)
} }
// Unpair: a sealed device (the grid operator's control box) can't be // Unpair: a sealed device (the grid operator's control box) can't be
// unpaired here: only its custodian lifts the seal (signed, from Cantabile). // unpaired here: only its custodian lifts the seal (signed, from Cantabile).
func (c *Core) Unpair(id, who string) error { func (c *Core) Unpair(id, who string) error {
ski, err := func() (string, error) {
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock()
d := c.device(id) d := c.device(id)
if d == nil || !d.Paired { if d == nil || !d.Paired {
c.mu.Unlock() return "", fmt.Errorf("no paired device %s", id)
return fmt.Errorf("no paired device %s", id)
} }
if level, cust := c.Level(d, "*"); level == LevelSealed { if level, cust := c.Level(d, "*"); level == LevelSealed {
c.audit("refused unpairing %s by %s: sealed (custodian %s)", d.Name, who, cust) c.audit("refused unpairing %s by %s: sealed (custodian %s)", d.Name, who, cust)
c.mu.Unlock() return "", fmt.Errorf("%w: %s is sealed by its custodian (%s)", ErrRefused, d.Name, cust)
return fmt.Errorf("%w: %s is sealed by its custodian (%s)", ErrRefused, d.Name, cust)
} }
c.forget(d) c.forget(d)
d.Paired, d.State = false, "discovered" d.Paired, d.State = false, "discovered"
@@ -345,8 +487,11 @@ func (c *Core) Unpair(id, who string) error {
c.save() c.save()
c.audit("unpaired %s (SKI %s) by %s", d.Name, d.SKI, who) c.audit("unpaired %s (SKI %s) by %s", d.Name, d.SKI, who)
c.nominalChanged() c.nominalChanged()
ski := d.SKI return d.SKI, nil
c.mu.Unlock() }()
if err != nil {
return err
}
return c.backend.Unpair(ski) return c.backend.Unpair(ski)
} }
@@ -503,6 +648,41 @@ func (c *Core) write(d *Device, key string, v float64) error {
// IsControlBox: the paired control box's SKI (the only one whose LPC // IsControlBox: the paired control box's SKI (the only one whose LPC
// writes the bridge approves). // writes the bridge approves).
// InternalError: a panic in the bridge's work for a device, contained
// (EEBUS.guard): an event on the page, with the device's name and the
// repeats since the last one. Called after a panic, which may have left the
// lock held: it waits at most a second for it, then the log line is all.
func (c *Core) InternalError(ski, what string, r any, repeats int) {
if !c.lockWithin(time.Second) {
log.Printf("internal error while %s for %s: %v (the core's lock is held: no event)", what, ski, r)
return
}
defer c.mu.Unlock()
name := ski
if d := c.devices[strings.ToLower(ski)]; d != nil && d.Name != "" {
name = d.Name
}
more := ""
if repeats > 0 {
more = fmt.Sprintf(", %d times more since the last report", repeats)
}
c.event("internal error while %s for %s: %v (contained%s; the bridge goes on)", what, name, r, more)
}
// lockWithin: the core's lock, if it comes within wait.
func (c *Core) lockWithin(wait time.Duration) bool {
deadline := time.Now().Add(wait)
for {
if c.mu.TryLock() {
return true
}
if time.Now().After(deadline) {
return false
}
time.Sleep(10 * time.Millisecond)
}
}
func (c *Core) IsControlBox(ski string) bool { func (c *Core) IsControlBox(ski string) bool {
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock() defer c.mu.Unlock()
@@ -714,6 +894,8 @@ func (c *Core) evaluateGrid() {
func (c *Core) gridChanged(old Grid) { func (c *Core) gridChanged(old Grid) {
g := c.grid g := c.grid
// a new limit, or the end of one: the limits written again start over
clear(c.resends)
switch g.State { switch g.State {
case "limited": case "limited":
c.audit("grid operator's limit %.0f W from %s (order %s, until %s)", g.LimitW, g.Device, g.OrderID, untilText(g.Until)) c.audit("grid operator's limit %.0f W from %s (order %s, until %s)", g.LimitW, g.Device, g.OrderID, untilText(g.Until))
@@ -1009,6 +1191,7 @@ func (c *Core) freeID(want string) string {
} }
func (c *Core) save() { func (c *Core) save() {
c.noteControlBox() // every change of pairing or kind is saved
if err := c.store.Save(); err != nil { if err := c.store.Save(); err != nil {
log.Printf("saving devices: %v", err) log.Printf("saving devices: %v", err)
} }
+305
View File
@@ -7,6 +7,7 @@ import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt"
"os" "os"
"strings" "strings"
"sync" "sync"
@@ -253,6 +254,310 @@ func TestGridOrderLimitedPassedOnAndSigned(t *testing.T) {
} }
} }
// A limit passed on but lost (written to a connection SHIP replaced): the
// device's next report shows another limit, and it gets the grid limit again.
func TestLostLimitPassedOnAgain(t *testing.T) {
h := newHarness(t, Options{PassOn: true})
_, hp, _ := h.home()
h.core.Update("cb01", nil, map[string]any{"grid_limit": 4200.0, "grid_limit_active": true, "_limit_duration": 900.0, "heartbeat": true})
if w := h.be.take(); !contains(w, hp.ID+" limit 4200 on") {
t.Fatalf("passed on: %v", w)
}
if got := h.core.PassedOnSKIs(); len(got) != 1 || got[0] != "hp01" {
t.Fatalf("read regularly: %v", got)
}
h.core.Update("hp01", nil, map[string]any{"limit": 9000.0, "limit_active": false})
if w := h.be.take(); len(w) != 1 || w[0] != hp.ID+" limit 4200 on" {
t.Fatalf("passed on again: %v", w)
}
// still not taken (refused, or lost again): written again only after
// the back-off, doubling (5 s, 10 s, ...)
h.core.Update("hp01", nil, map[string]any{"limit": 9000.0, "limit_active": false})
if w := h.be.take(); len(w) != 0 {
t.Fatalf("within the back-off: %v", w)
}
h.clock = h.clock.Add(PassOnRetryFirst)
h.core.Update("hp01", nil, map[string]any{"limit": 9000.0, "limit_active": false})
if w := h.be.take(); len(w) != 1 {
t.Fatalf("after 5 s: %v", w)
}
h.clock = h.clock.Add(PassOnRetryFirst)
h.core.Update("hp01", nil, map[string]any{"limit": 9000.0, "limit_active": false})
if w := h.be.take(); len(w) != 0 {
t.Fatalf("the second wait is 10 s: %v", w)
}
// a device that rounds holds it: nothing written
h.core.Update("hp01", nil, map[string]any{"limit": 4199.6, "limit_active": true})
if w := h.be.take(); len(w) != 0 {
t.Fatalf("holds it (rounded): %v", w)
}
// and a later loss starts the back-off again from 5 s
h.core.Update("hp01", nil, map[string]any{"limit": 9000.0, "limit_active": false})
if w := h.be.take(); len(w) != 1 {
t.Fatalf("lost again: %v", w)
}
}
// A panic in our own work for the control box, on every poll: its link
// stays (never dropped or renewed: that would set it offline and move the
// §14a limit to its failsafe), the grid order stays as it is; the event is
// rate-limited. Another device's connection is renewed, with back-off.
func TestPanicKeepsTheControlBoxLink(t *testing.T) {
h := newHarness(t, Options{PassOn: true})
_, _, _ = h.home()
h.core.Update("cb01", nil, map[string]any{"grid_limit": 4200.0, "grid_limit_active": true, "_limit_duration": 900.0, "heartbeat": true})
if h.core.ControlBoxSKINow() != "cb01" {
t.Fatalf("the control box, lock-free: %q", h.core.ControlBoxSKINow())
}
var mu sync.Mutex
dropped := []string{}
e := &EEBUS{core: h.core, drop: func(ski string) { mu.Lock(); dropped = append(dropped, ski); mu.Unlock() }}
for i := 0; i < 200; i++ {
e.guard("cb01", "reading", func() { panic(fmt.Sprintf("index %d out of range", i)) })
}
time.Sleep(3 * time.Second) // afterPanic runs on its own goroutines
mu.Lock()
n := len(dropped)
mu.Unlock()
if n != 0 {
t.Fatalf("the control box was dropped %d times", n)
}
if o := h.order(); o["state"] != "limited" || o["limit_w"] != 4200.0 {
t.Fatalf("the grid order after 200 panics: %v", o)
}
h.core.mu.Lock()
events := strings.Join(h.core.events, "\n")
h.core.mu.Unlock()
// one site (the panic's value changes, its place doesn't): one event
if c := strings.Count(events, "internal error while reading"); c != 1 {
t.Fatalf("%d events:\n%s", c, events)
}
// another device: the first panics only log and count; renewed once it
// panicked PanicRenewAfter times within the window
for i := 0; i < PanicRenewAfter; i++ {
e.guard("hp01", "reading", func() { panic("a bug of ours") })
}
time.Sleep(time.Second)
mu.Lock()
n = len(dropped)
mu.Unlock()
if n != 1 {
t.Fatalf("the heat pump: dropped %d times", n)
}
// unpaired: the lock-free record follows
if err := h.core.Unpair("cb01", "test"); err == nil || h.core.ControlBoxSKINow() != "cb01" {
// sealed: refused, stays the control box
t.Fatalf("sealed control box: %v %q", err, h.core.ControlBoxSKINow())
}
}
// A panic repeating on every poll: logged and shown once per
// PanicReportEvery with the repeats counted; a device's connection is
// renewed once it panicked PanicRenewAfter times within PanicRenewWindow,
// then with a doubling back-off; a device that alternates panics and normal
// runs isn't renewed more often; the back-off ends after a window without a
// panic.
func TestRepeatingPanicRateLimited(t *testing.T) {
var p panicLog
now := time.Unix(1_800_000_000, 0)
site := "core.go:1 < eebus.go:2"
reports := 0
var renewedAt []int
for i := 0; i < 200; i++ { // 200 polls, 5 s apart: 1000 s
report, repeats, renew := p.record("hp01", "reading", site, now)
if report {
reports++
if reports == 2 && repeats != 119 {
t.Fatalf("repeats counted: %d", repeats)
}
}
if renew {
renewedAt = append(renewedAt, i)
}
now = now.Add(5 * time.Second)
}
if reports != 2 { // at 0 s and 600 s
t.Fatalf("reports in 1000 s: %d", reports)
}
// the 5th panic (poll 4), then 1, 2, 4, 8 min later
if fmt.Sprint(renewedAt) != "[4 16 40 88 184]" {
t.Fatalf("renewed at polls %v", renewedAt)
}
// alternating panics and normal runs (every 10 s): the same pace, the
// normal runs don't reset the back-off
var q panicLog
now = time.Unix(1_800_000_000, 0)
renewedAt = nil
for i := 0; i < 200; i++ {
if i%2 == 0 {
if _, _, renew := q.record("hp02", "reading", site, now); renew {
renewedAt = append(renewedAt, i)
}
} else {
q.ok("hp02", "reading", now)
}
now = now.Add(5 * time.Second)
}
if fmt.Sprint(renewedAt) != "[8 20 44 92 188]" {
t.Fatalf("alternating: renewed at polls %v", renewedAt)
}
// a whole window without a panic: ended (and the first panics again
// only count)
now = now.Add(PanicRenewWindow)
q.ok("hp02", "reading", now)
if q.active.Load() != 0 {
t.Fatal("not ended after a quiet window")
}
for i := 0; i < PanicRenewAfter; i++ {
_, _, renew := q.record("hp02", "reading", site, now)
if renew != (i == PanicRenewAfter-1) {
t.Fatalf("after a quiet window, panic %d: renew %v", i, renew)
}
now = now.Add(5 * time.Second)
}
// many sites and works: kept within their caps
for i := 0; i < 2*panicSitesMax; i++ {
p.record("hp01", "reading", fmt.Sprintf("site %d", i), now)
}
for i := 0; i < 2*panicWorksMax; i++ {
p.record(fmt.Sprintf("dev%d", i), "reading", "x", now)
}
if len(p.works) > panicWorksMax {
t.Fatalf("works: %d", len(p.works))
}
for _, w := range p.works {
if len(w.sites) > panicSitesMax {
t.Fatalf("sites: %d", len(w.sites))
}
}
}
// The panic's site is its place in the code, not its value.
func TestPanicSiteWithoutTheValue(t *testing.T) {
site := func(i int) (s string) {
defer func() { _ = recover(); s = panicSiteOf(2) }()
panic(fmt.Sprintf("index %d", i))
}
if a, b := site(1), site(2); a != b || !strings.Contains(a, "TestPanicSiteWithoutTheValue") {
t.Fatalf("sites: %q %q", a, b)
}
}
// A 0 W target (full curtailment) backs off and starts over like any other:
// on a confirmed hold and a new grid limit or its end, not on a reconnect.
func TestPassOnBackOffWithZeroWatts(t *testing.T) {
h := newHarness(t, Options{PassOn: true})
_, hp, _ := h.home()
h.core.Update("cb01", nil, map[string]any{"grid_limit": 4200.0, "grid_limit_active": true, "_limit_duration": 900.0, "heartbeat": true})
h.be.take()
h.core.mu.Lock()
hp.Applied["limit"] = 0
h.core.mu.Unlock()
lost := map[string]any{"limit": 9000.0, "limit_active": false}
write := func(what string, want int) {
t.Helper()
h.core.Update("hp01", nil, lost)
if w := h.be.take(); len(w) != want {
t.Fatalf("%s: %v", what, w)
}
}
write("first", 1)
write("backing off", 0)
// a confirmed hold of 0 W starts it over
h.core.Update("hp01", nil, map[string]any{"limit": 0.0, "limit_active": true})
write("lost after a hold", 1)
write("backing off again", 0)
// a reconnect makes the next write due at once (§14a: back without
// the limit otherwise), keeping the count: the wait after it is longer
h.core.Connected("hp01", false)
h.core.Connected("hp01", true)
write("after a reconnect: written at once", 1)
write("then backing off", 0)
// a repeated report of the same state changes nothing
h.core.Connected("hp01", true)
write("a same-state report: still backing off", 0)
h.clock = h.clock.Add(PassOnRetryFirst << 1)
write("after the longer back-off", 1)
// a new grid limit starts it over (and is passed on)
h.clock = h.clock.Add(time.Second)
h.core.LimitWritten("cb01")
h.core.Update("cb01", nil, map[string]any{"grid_limit": 4300.0, "grid_limit_active": true, "_limit_duration": 900.0, "heartbeat": true})
h.be.take()
h.core.mu.Lock()
hp.Applied["limit"] = 0
h.core.mu.Unlock()
write("after a new grid limit", 1)
}
// A connection reported twice (the library's SHIP ID and a setup after a
// twin's close): the second report changes nothing, no event.
func TestConnectedTwiceIsOnce(t *testing.T) {
h := newHarness(t, Options{PassOn: true})
_, _, _ = h.home()
h.core.Connected("hp01", false)
h.core.mu.Lock()
n := len(h.core.events)
h.core.mu.Unlock()
h.core.Connected("hp01", true)
h.core.Connected("hp01", true)
h.core.Connected("cb01", true)
h.core.mu.Lock()
got := h.core.events[n:]
h.core.mu.Unlock()
if len(got) != 1 || !strings.Contains(got[0], "online") {
t.Fatalf("events: %v", got)
}
}
// §14a: a device back after being away gets the grid limit on the next
// check, even with its back-off at the maximum.
func TestReconnectGetsTheLimitAtOnce(t *testing.T) {
h := newHarness(t, Options{PassOn: true})
_, hp, _ := h.home()
h.core.Update("cb01", nil, map[string]any{"grid_limit": 4200.0, "grid_limit_active": true, "_limit_duration": 900.0, "heartbeat": true})
h.be.take()
lost := map[string]any{"limit": 9000.0, "limit_active": false}
for i := 0; i < 12; i++ { // up to the 5 min maximum
h.core.Update("hp01", nil, lost)
h.be.take()
h.clock = h.clock.Add(DefaultPassOnRetryMax)
}
h.core.Update("hp01", nil, lost)
h.be.take()
h.core.Update("hp01", nil, lost)
if w := h.be.take(); len(w) != 0 {
t.Fatalf("at the maximum back-off: %v", w)
}
h.core.Connected("hp01", false)
h.core.Connected("hp01", true)
h.core.Update("hp01", nil, lost)
if w := h.be.take(); len(w) != 1 || w[0] != hp.ID+" limit 4200 on" {
t.Fatalf("after the reconnect: %v", w)
}
}
// The back-off never grows past Options.PassOnRetryMax.
func TestPassOnBackOffCapped(t *testing.T) {
h := newHarness(t, Options{PassOn: true, PassOnRetryMax: 20 * time.Second})
_, _, _ = h.home()
h.core.Update("cb01", nil, map[string]any{"grid_limit": 4200.0, "grid_limit_active": true, "_limit_duration": 900.0, "heartbeat": true})
h.be.take()
writes := 0
for i := 0; i < 40; i++ { // 40 × 5 s = 200 s: 5, 10, 20, 20, ... s apart
h.core.Update("hp01", nil, map[string]any{"limit": 9000.0, "limit_active": false})
writes += len(h.be.take())
h.clock = h.clock.Add(5 * time.Second)
}
if writes < 9 || writes > 12 {
t.Fatalf("writes in 200 s with a 20 s cap: %d", writes)
}
}
func TestSharesBetweenDevices(t *testing.T) { func TestSharesBetweenDevices(t *testing.T) {
h := newHarness(t, Options{}) h := newHarness(t, Options{})
_, hp, wb := h.home() _, hp, wb := h.home()
+275 -20
View File
@@ -12,11 +12,14 @@ import (
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
"slices"
"strings" "strings"
"sync" "sync"
"time" "time"
"unicode"
eebusapi "github.com/enbility/eebus-go/api" eebusapi "github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/client"
"github.com/enbility/eebus-go/service" "github.com/enbility/eebus-go/service"
ucapi "github.com/enbility/eebus-go/usecases/api" ucapi "github.com/enbility/eebus-go/usecases/api"
"github.com/enbility/eebus-go/usecases/cem/evcc" "github.com/enbility/eebus-go/usecases/cem/evcc"
@@ -56,9 +59,18 @@ type EEBUS struct {
ifaces []string ifaces []string
mdnsSel mdns.MdnsProviderSelection mdnsSel mdns.MdnsProviderSelection
svc *service.Service // the energy manager toward the devices svc *service.Service // the energy manager toward the devices
qmu sync.Mutex // the callback queue (async)
queue []func()
qrun bool
grid *gridLink // the controllable system toward the control box, its own process (grid.go) grid *gridLink // the controllable system toward the control box, its own process (grid.go)
core *Core core *Core
ski, gridSKI string ski, gridSKI string
smu sync.Mutex // gridSKI (set when the grid identity's child reports it)
bmu sync.Mutex // bound
bound map[string]time.Time // binding requests sent again, by SKI and feature (bindDue)
bindFails map[string]bindFailure // binding requests not sent, by SKI and feature (bindFailed)
drop func(ski string) // drops a device's connection after a panic (nil: disconnect; tests)
panics panicLog // contained panics (panics.go)
mu sync.Mutex mu sync.Mutex
pmu sync.Mutex pmu sync.Mutex
pending map[string]bool pending map[string]bool
@@ -90,7 +102,11 @@ func (e *EEBUS) Name() string { return "eebus" }
func (e *EEBUS) LocalSKI() string { return e.ski } func (e *EEBUS) LocalSKI() string { return e.ski }
// GridSKI: the identity the grid operator's control box pairs with. // GridSKI: the identity the grid operator's control box pairs with.
func (e *EEBUS) GridSKI() string { return e.gridSKI } func (e *EEBUS) GridSKI() string {
e.smu.Lock()
defer e.smu.Unlock()
return e.gridSKI
}
// LoadCertificate: the bridge's own (name: "eebus" or "eebus-grid"), made once. // LoadCertificate: the bridge's own (name: "eebus" or "eebus-grid"), made once.
func LoadCertificate(dir, serial string) (tls.Certificate, string, error) { func LoadCertificate(dir, serial string) (tls.Certificate, string, error) {
@@ -203,7 +219,7 @@ func (e *EEBUS) Start(c *Core) error {
e.core.OnNominal = func(w float64) { gl.send(gridMsg{Cmd: "nominal", W: w}) } e.core.OnNominal = func(w float64) { gl.send(gridMsg{Cmd: "nominal", W: w}) }
e.core.mu.Unlock() e.core.mu.Unlock()
e.svc.Start() e.svc.Start()
log.Printf("EEBUS: devices SKI %s (port %d), grid SKI %s (port %d)", e.ski, e.port+1, e.gridSKI, e.port) log.Printf("EEBUS: devices SKI %s (port %d), grid SKI %s (port %d)", e.ski, e.port+1, e.GridSKI(), e.port)
go e.poll() go e.poll()
return nil return nil
} }
@@ -224,18 +240,20 @@ type reader struct {
} }
func (r reader) RemoteSKIConnected(_ eebusapi.ServiceInterface, ski string) { func (r reader) RemoteSKIConnected(_ eebusapi.ServiceInterface, ski string) {
r.e.core.Connected(ski, true) r.e.async(ski, func() { r.e.core.Connected(ski, true) })
} }
func (r reader) RemoteSKIDisconnected(_ eebusapi.ServiceInterface, ski string) { func (r reader) RemoteSKIDisconnected(_ eebusapi.ServiceInterface, ski string) {
r.e.core.Connected(ski, false) r.e.forgetBindings(ski) // (not the panics' back-off: a renewed connection must not restart it)
r.e.async(ski, func() { r.e.core.Connected(ski, false) })
} }
func (r reader) ServiceShipIDUpdate(string, string) {} func (r reader) ServiceShipIDUpdate(string, string) {}
func (r reader) VisibleRemoteServicesUpdated(_ eebusapi.ServiceInterface, entries []shipapi.RemoteService) { func (r reader) VisibleRemoteServicesUpdated(_ eebusapi.ServiceInterface, entries []shipapi.RemoteService) {
for _, s := range entries { for _, s := range entries {
if strings.EqualFold(s.Ski, r.e.ski) || strings.EqualFold(s.Ski, r.e.gridSKI) { if strings.EqualFold(s.Ski, r.e.ski) || strings.EqualFold(s.Ski, r.e.GridSKI()) {
continue // the bridge's other identity continue // the bridge's other identity
} }
r.e.core.Seen(s.Ski, s.Brand, s.Model, s.Type, s.Name) s := s
r.e.async(s.Ski, func() { r.e.core.Seen(s.Ski, s.Brand, s.Model, s.Type, s.Name) })
} }
} }
func (r reader) ServicePairingDetailUpdate(ski string, detail *shipapi.ConnectionStateDetail) { func (r reader) ServicePairingDetailUpdate(ski string, detail *shipapi.ConnectionStateDetail) {
@@ -246,12 +264,55 @@ func (r reader) ServicePairingDetailUpdate(ski string, detail *shipapi.Connectio
r.e.onGrid[strings.ToLower(ski)] = true r.e.onGrid[strings.ToLower(ski)] = true
r.e.mu.Unlock() r.e.mu.Unlock()
} }
r.e.core.PairingRequest(ski) r.e.async(ski, func() { r.e.core.PairingRequest(ski) })
case shipapi.ConnectionStateRemoteDeniedTrust: case shipapi.ConnectionStateRemoteDeniedTrust:
r.e.core.Denied(ski) r.e.async(ski, func() { r.e.core.Denied(ski) })
} }
} }
// async: what the library reports reaches the core in order, but on the
// bridge's own goroutine. The core holds its lock while it writes to a
// device through the library (passOn); the library's callbacks run inside
// its own locks (ship-go's per-connection sync.Once on a close), so a
// callback that waited for the core's lock made a deadlock: the writer
// waited for the Once, the Once's holder for the core (the hang of CI run
// 709ea10b, 2026-11-13). Each runs guarded for its device (guard).
func (e *EEBUS) async(ski string, f func()) {
e.qmu.Lock()
e.queue = append(e.queue, func() { e.guard(ski, "a library callback", f) })
start := !e.qrun
e.qrun = true
e.qmu.Unlock()
if !start {
return
}
go func() {
for {
e.qmu.Lock()
if len(e.queue) == 0 {
e.qrun = false
e.qmu.Unlock()
return
}
f := e.queue[0]
e.queue = e.queue[1:]
e.qmu.Unlock()
f()
}
}()
}
// disconnect: drop a device's connection after a panic (itself guarded: a
// broken connection must not take the bridge down either).
func (e *EEBUS) disconnect(ski string) {
defer func() {
if r := recover(); r != nil {
log.Printf("EEBUS: dropping %s panicked: %v", ski, r)
}
}()
e.svc.DisconnectSKI(ski, "internal error")
}
func (e *EEBUS) Pair(ski, kind string) error { func (e *EEBUS) Pair(ski, kind string) error {
if e.onGridIdentity(ski, kind) { if e.onGridIdentity(ski, kind) {
e.grid.send(gridMsg{Cmd: "pair", SKI: ski}) e.grid.send(gridMsg{Cmd: "pair", SKI: ski})
@@ -296,6 +357,14 @@ func entityOf(uc eebusapi.UseCaseInterface, ski string, live spineapi.DeviceRemo
} }
found = r.Entity // the newest when SPINE knows none found = r.Entity // the newest when SPINE knows none
} }
// only a dropped connection's entity is listed (the use case hasn't seen
// the live connection's yet): the live device's entity at the same
// address. Writes to the dropped one go nowhere, without an error.
if found != nil && live != nil && found.Device() != live && found.Address() != nil {
if e := live.Entity(found.Address().Entity); e != nil {
return e
}
}
return found return found
} }
@@ -308,15 +377,8 @@ func (e *EEBUS) WriteLimit(d *Device, watts float64, active bool) error {
if ent == nil { if ent == nil {
return fmt.Errorf("%s offers no LPC", d.Name) return fmt.Errorf("%s offers no LPC", d.Name)
} }
_, err := e.eglpc.WriteConsumptionLimit(ent, ucapi.LoadLimit{Value: watts, IsActive: active}, func(r model.ResultDataType) { _, err := e.eglpc.WriteConsumptionLimit(ent, ucapi.LoadLimit{Value: watts, IsActive: active},
if r.ErrorNumber != nil && *r.ErrorNumber != model.ErrorNumberTypeNoError { e.onRefusal(d, fmt.Sprintf("the limit %.0f W", watts), ent))
desc := ""
if r.Description != nil {
desc = string(*r.Description)
}
log.Printf("%s refused the limit %.0f W: %s", d.Name, watts, desc)
}
})
return err return err
} }
@@ -331,10 +393,199 @@ func (e *EEBUS) WriteCurrent(d *Device, amps float64) error {
for _, p := range phases { for _, p := range phases {
limits = append(limits, ucapi.LoadLimitsPhase{Phase: p, IsActive: true, Value: amps}) limits = append(limits, ucapi.LoadLimitsPhase{Phase: p, IsActive: true, Value: amps})
} }
_, err := e.opev.WriteLoadControlLimits(ent, limits, nil) _, err := e.opev.WriteLoadControlLimits(ent, limits, e.onRefusal(d, fmt.Sprintf("the current %.0f A", amps), ent))
return err return err
} }
// onRefusal: the result callback of a write to a device's LoadControl
// server (an LPC limit, an OPEV current): a refusal is logged; one for a
// missing binding requests the binding again (bind), and the core's next
// check writes the value again (Core.checkPassedOn).
func (e *EEBUS) onRefusal(d *Device, what string, ent spineapi.EntityRemoteInterface) func(model.ResultDataType) {
return func(r model.ResultDataType) {
if r.ErrorNumber == nil || *r.ErrorNumber == model.ErrorNumberTypeNoError {
return
}
desc := ""
if r.Description != nil {
desc = string(*r.Description)
}
log.Printf("%s refused %s: %s", d.Name, what, desc)
if bindingMissing(r) {
go e.bind(d.SKI, ent)
}
}
}
// bindingMissing: the refusal for a missing binding: its error number;
// spine-go's text ("write denied due to missing binding", sent as a general
// error); or another stack's general error that names the binding and is a
// refusal (any case: "Binding required", "not bound", "write refused: no
// binding"), not just any text with "binding" in it.
func bindingMissing(r model.ResultDataType) bool {
if *r.ErrorNumber == model.ErrorNumberTypeBindingIsNecessaryForThisCommand {
return true
}
if r.Description == nil {
return false
}
desc := strings.ToLower(string(*r.Description))
if strings.Contains(desc, "denied due to missing binding") {
return true
}
if *r.ErrorNumber != model.ErrorNumberTypeGeneralError {
return false
}
// whole words only: "out of bounds" is a value's refusal, not a binding's
words := strings.FieldsFunc(desc, func(r rune) bool { return !unicode.IsLetter(r) })
has := func(w string) bool { return slices.Contains(words, w) }
phrase := func(a, b string) bool {
for i := 0; i+1 < len(words); i++ {
if words[i] == a && words[i+1] == b {
return true
}
}
return false
}
if has("unbound") || phrase("not", "bound") || phrase("no", "binding") || phrase("without", "binding") {
return true
}
if !has("binding") && !has("bindings") {
return false
}
for _, w := range []string{"denied", "refused", "rejected", "missing", "required", "necessary", "needed"} {
if has(w) {
return true
}
}
return false
}
// BindRetryMin: the shortest time between two binding requests to the same
// feature of a device (a device that refuses each write would otherwise get
// one per refused write).
const BindRetryMin = 30 * time.Second
// bind: request the binding to the device's LoadControl server again, at
// most once per BindRetryMin per device and feature. The bridge's own
// record says it is bound (eebus-go binds once per entity), but the device
// lost the binding: it was made on a connection that SHIP replaced, or the
// device removed it with the dropped side of a double connection. The
// device then refuses every write ("write denied due to missing binding")
// until a new binding request.
func (e *EEBUS) bind(ski string, ent spineapi.EntityRemoteInterface) {
e.guard(ski, "binding", func() {
path := entityPath(ent)
// the slot is held while the request is made (no second at once),
// and kept only if it was sent
if !e.bindDue(ski, path, time.Now()) {
return
}
lc, err := client.NewLoadControl(e.svc.LocalDevice().EntityForType(model.EntityTypeTypeCEM), ent)
if err == nil {
_, err = lc.Bind()
}
if err != nil {
e.bindFailed(ski, path, time.Now(), err)
return
}
e.bindSent(ski, path)
log.Printf("EEBUS: %s lost its binding: requested again", ski)
})
}
// entityPath: the entity's address within its device ("1.2"), the same for
// the entity of a connection and of its successor (not the pointer).
func entityPath(ent spineapi.EntityRemoteInterface) string {
if ent == nil || ent.Address() == nil {
return ""
}
parts := []string{}
for _, a := range ent.Address().Entity {
parts = append(parts, fmt.Sprint(uint(a)))
}
return strings.Join(parts, ".")
}
// forgetBindings: a device's binding requests (its connection ended: the
// next connection binds as new).
func (e *EEBUS) forgetBindings(ski string) {
e.bmu.Lock()
defer e.bmu.Unlock()
prefix := strings.ToLower(ski) + " "
for k := range e.bound {
if strings.HasPrefix(k, prefix) {
delete(e.bound, k)
}
}
for k := range e.bindFails {
if strings.HasPrefix(k, prefix) {
delete(e.bindFails, k)
}
}
}
// BindFailMax: the longest wait after binding requests that couldn't be
// sent (BindRetryMin, doubling up to it).
const BindFailMax = 10 * time.Minute
// bindFailure: requests to one device's feature that couldn't be sent.
type bindFailure struct {
n int
next time.Time
}
// bindFailed: the request wasn't sent (the client couldn't be made, or the
// request not written): its slot freed, and a back-off for this device and
// feature (BindRetryMin, doubling up to BindFailMax) so a lasting failure
// isn't retried on every refused write; logged once per step.
func (e *EEBUS) bindFailed(ski, feature string, now time.Time, err error) {
e.bmu.Lock()
defer e.bmu.Unlock()
key := strings.ToLower(ski) + " " + feature
delete(e.bound, key)
if e.bindFails == nil {
e.bindFails = map[string]bindFailure{}
}
f := e.bindFails[key]
wait := BindRetryMin << f.n
if wait > BindFailMax || wait <= 0 {
wait = BindFailMax
}
f.n++
f.next = now.Add(wait)
e.bindFails[key] = f
log.Printf("EEBUS: binding to %s (%s) not sent (%v): next try after %s", ski, feature, err, wait)
}
// bindDue: whether a binding request to this device's feature may go out
// now (one in flight, sent less than BindRetryMin ago, or within a failure's
// back-off: not); true takes the slot (bindFailed frees it, bindSent keeps
// it and ends a failure's back-off).
func (e *EEBUS) bindDue(ski, feature string, now time.Time) bool {
e.bmu.Lock()
defer e.bmu.Unlock()
if e.bound == nil {
e.bound = map[string]time.Time{}
}
key := strings.ToLower(ski) + " " + feature
if last, ok := e.bound[key]; ok && now.Sub(last) < BindRetryMin {
return false
}
if f, ok := e.bindFails[key]; ok && now.Before(f.next) {
return false
}
e.bound[key] = now
return true
}
// bindSent: the request went out: a failure's back-off ends.
func (e *EEBUS) bindSent(ski, feature string) {
e.bmu.Lock()
defer e.bmu.Unlock()
delete(e.bindFails, strings.ToLower(ski)+" "+feature)
}
// -- eebus-go's callbacks ---------------------------------------------------- // -- eebus-go's callbacks ----------------------------------------------------
func (e *EEBUS) onEvent(ski string, _ spineapi.DeviceRemoteInterface, _ spineapi.EntityRemoteInterface, _ eebusapi.EventType) { func (e *EEBUS) onEvent(ski string, _ spineapi.DeviceRemoteInterface, _ spineapi.EntityRemoteInterface, _ eebusapi.EventType) {
@@ -363,7 +614,7 @@ func (e *EEBUS) later(ski string) {
e.pmu.Lock() e.pmu.Lock()
delete(e.pending, ski) delete(e.pending, ski)
e.pmu.Unlock() e.pmu.Unlock()
e.refresh(ski) e.guard(ski, "reading", func() { e.refresh(ski) })
}() }()
} }
@@ -372,7 +623,11 @@ func (e *EEBUS) later(ski string) {
func (e *EEBUS) poll() { func (e *EEBUS) poll() {
for range time.Tick(5 * time.Second) { for range time.Tick(5 * time.Second) {
if ski := e.core.ControlBoxSKI(); ski != "" { if ski := e.core.ControlBoxSKI(); ski != "" {
e.refresh(ski) e.guard(ski, "reading", func() { e.refresh(ski) })
}
// the devices holding the grid limit: one that lost it gets it again (Core.checkPassedOn)
for _, ski := range e.core.PassedOnSKIs() {
e.guard(ski, "reading", func() { e.refresh(ski) })
} }
} }
} }
+179 -20
View File
@@ -5,6 +5,8 @@ package main
import ( import (
"errors" "errors"
"os" "os"
"os/exec"
"strings"
"testing" "testing"
"time" "time"
@@ -172,7 +174,7 @@ func TestReadUseCasesWithMocks(t *testing.T) {
type remote struct { type remote struct {
svc *service.Service svc *service.Service
connected chan string connected chan string
trust string // the SKI whose pairing request it approves (its installer's confirmation) trust map[string]bool // the SKIs whose pairing request it approves (its installer's confirmation)
} }
func (r *remote) RemoteSKIConnected(_ eebusapi.ServiceInterface, ski string) { func (r *remote) RemoteSKIConnected(_ eebusapi.ServiceInterface, ski string) {
@@ -185,7 +187,7 @@ func (r *remote) RemoteSKIDisconnected(eebusapi.ServiceInterface, string)
func (r *remote) VisibleRemoteServicesUpdated(eebusapi.ServiceInterface, []shipapi.RemoteService) {} func (r *remote) VisibleRemoteServicesUpdated(eebusapi.ServiceInterface, []shipapi.RemoteService) {}
func (r *remote) ServiceShipIDUpdate(string, string) {} func (r *remote) ServiceShipIDUpdate(string, string) {}
func (r *remote) ServicePairingDetailUpdate(ski string, d *shipapi.ConnectionStateDetail) { func (r *remote) ServicePairingDetailUpdate(ski string, d *shipapi.ConnectionStateDetail) {
if d.State() == shipapi.ConnectionStateReceivedPairingRequest && ski == r.trust { if d.State() == shipapi.ConnectionStateReceivedPairingRequest && r.trust[ski] {
r.svc.RegisterRemoteSKI(ski) r.svc.RegisterRemoteSKI(ski)
} }
} }
@@ -201,7 +203,7 @@ func newRemote(t *testing.T, dir string, port int, typ model.DeviceTypeType, ent
t.Fatal(err) t.Fatal(err)
} }
conf.SetMdnsProviderSelection(mdns.MdnsProviderSelectionGoZeroConfOnly) conf.SetMdnsProviderSelection(mdns.MdnsProviderSelectionGoZeroConfOnly)
r := &remote{connected: make(chan string, 4)} r := &remote{connected: make(chan string, 4), trust: map[string]bool{}}
r.svc = service.NewService(conf, r) r.svc = service.NewService(conf, r)
r.svc.SetLogging(ebLog{}) r.svc.SetLogging(ebLog{})
if err := r.svc.Setup(); err != nil { if err := r.svc.Setup(); err != nil {
@@ -211,6 +213,26 @@ func newRemote(t *testing.T, dir string, port int, typ model.DeviceTypeType, ent
return r, ski return r, ski
} }
// tempDir: like t.TempDir, but the removal waits for a service's last
// write (a goroutine still saving made "directory not empty" fail the test
// after its last assertion, 2026-11-13).
func tempDir(t *testing.T) string {
t.Helper()
dir, err := os.MkdirTemp("", "eebus")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
for i := 0; i < 50; i++ {
if os.RemoveAll(dir) == nil {
return
}
time.Sleep(100 * time.Millisecond)
}
})
return dir
}
func waitFor(t *testing.T, what string, d time.Duration, ok func() bool) { func waitFor(t *testing.T, what string, d time.Duration, ok func() bool) {
t.Helper() t.Helper()
end := time.Now().Add(d) end := time.Now().Add(d)
@@ -223,11 +245,134 @@ func waitFor(t *testing.T, what string, d time.Duration, ok func() bool) {
t.Fatalf("timed out waiting for %s", what) t.Fatalf("timed out waiting for %s", what)
} }
// A panic in the work for one device is logged and contained: the callback
// queue goes on with the next device's callback.
func TestPanicInACallbackIsContained(t *testing.T) {
e := &EEBUS{}
done := make(chan struct{})
e.async("bad", func() { panic("a bug for one device") })
e.async("good", func() { close(done) })
select {
case <-done:
case <-time.After(5 * time.Second):
t.Fatal("the queue stopped after a panic")
}
e.guard("bad", "reading", func() {
var m map[string]int
m["x"] = 1
})
}
// A refusal for a missing binding requests the binding again, once per
// device and feature within BindRetryMin; other refusals don't.
func TestBindingRequestedAgainOnceAndOnlyForItsRefusal(t *testing.T) {
desc := func(s string) *model.DescriptionType { d := model.DescriptionType(s); return &d }
general, binding, busy := model.ErrorNumberTypeGeneralError, model.ErrorNumberTypeBindingIsNecessaryForThisCommand, model.ErrorNumberTypeTimeout
for _, c := range []struct {
r model.ResultDataType
want bool
}{
{model.ResultDataType{ErrorNumber: &general, Description: desc("write denied due to missing binding")}, true},
{model.ResultDataType{ErrorNumber: &binding}, true},
{model.ResultDataType{ErrorNumber: &general, Description: desc("binding table full")}, false},
{model.ResultDataType{ErrorNumber: &general, Description: desc("value out of range")}, false},
{model.ResultDataType{ErrorNumber: &general, Description: desc("Binding required")}, true},
{model.ResultDataType{ErrorNumber: &general, Description: desc("WRITE REFUSED: client not bound")}, true},
{model.ResultDataType{ErrorNumber: &general, Description: desc("no binding for this feature")}, true},
{model.ResultDataType{ErrorNumber: &busy, Description: desc("binding required")}, false},
// a value's refusal: "bounds" is not "bound"
{model.ResultDataType{ErrorNumber: &general, Description: desc("value out of bounds: a value within the bounds is required")}, false},
{model.ResultDataType{ErrorNumber: &general, Description: desc("upper bound exceeded, write refused")}, false},
{model.ResultDataType{ErrorNumber: &general, Description: desc("client unbound")}, true},
} {
if got := bindingMissing(c.r); got != c.want {
t.Fatalf("%v: %v", c.r.Description, got)
}
}
e := &EEBUS{}
now := time.Unix(1_800_000_000, 0)
if !e.bindDue("AA", "lc", now) || e.bindDue("aa", "lc", now.Add(time.Second)) {
t.Fatal("a second request within BindRetryMin")
}
if !e.bindDue("aa", "other", now) || !e.bindDue("bb", "lc", now) {
t.Fatal("other features and devices are separate")
}
if !e.bindDue("aa", "lc", now.Add(BindRetryMin)) {
t.Fatal("after BindRetryMin")
}
// a request that couldn't be sent: its slot freed, a back-off for the
// failure (BindRetryMin, doubling up to BindFailMax), ended by a sent one
at := now
for n, wait := range []time.Duration{BindRetryMin, 2 * BindRetryMin, 4 * BindRetryMin, 8 * BindRetryMin, 16 * BindRetryMin, BindFailMax, BindFailMax} {
if !e.bindDue("cc", "lc", at) {
t.Fatalf("failure %d: not due after its back-off", n)
}
e.bindFailed("cc", "lc", at, errNo)
if e.bindDue("cc", "lc", at.Add(wait-time.Second)) {
t.Fatalf("failure %d: retried within %s", n, wait)
}
at = at.Add(wait)
}
if !e.bindDue("cc", "lc", at) {
t.Fatal("cc")
}
e.bindSent("cc", "lc")
if e.bindDue("cc", "lc", at.Add(time.Second)) || !e.bindDue("cc", "lc", at.Add(BindRetryMin)) {
t.Fatal("after a sent request: the plain BindRetryMin")
}
// the device's connection ended: its next connection binds as new
e.forgetBindings("AA")
if !e.bindDue("aa", "lc", now.Add(BindRetryMin+time.Second)) || e.bindDue("bb", "lc", now.Add(time.Second)) {
t.Fatal("forgetting one device's requests")
}
}
// TestSHIPControlBoxAndHeatPump runs the in-process SHIP test in a child
// process, once: three services share eebus-go's global event bus, which
// one process holds only once, and a hang ends at the child's 90 s timeout
// with its goroutine dump (not at the 5 min go test timeout). No retries: a
// crash or a failed assertion in the child fails this test, with the
// child's assertion lines and its panic's first stack lines, then its
// output's end.
func TestSHIPControlBoxAndHeatPump(t *testing.T) { func TestSHIPControlBoxAndHeatPump(t *testing.T) {
if os.Getenv("EEBUS_SHIP_TEST") != "1" { if os.Getenv("EEBUS_SHIP_TEST") != "1" {
t.Skip("EEBUS_SHIP_TEST=1 runs SHIP over TCP with mDNS") t.Skip("EEBUS_SHIP_TEST=1 runs SHIP over TCP with mDNS")
} }
dir := t.TempDir() cmd := exec.Command(os.Args[0], "-test.run", "^TestSHIPInProcess$", "-test.count=1", "-test.timeout", "90s", "-test.v")
cmd.Env = append(os.Environ(), "EEBUS_SHIP_CHILD=1")
out, err := cmd.CombinedOutput()
if err == nil {
return
}
if f := os.Getenv("EEBUS_SHIP_OUT"); f != "" {
_ = os.WriteFile(f, out, 0o644) // the child's whole output (its goroutine dump on a hang)
}
// the assertion and panic lines first (a CI log keeps what matches), then the output's tail
var keep []string
stack := 0
for _, l := range strings.Split(string(out), "\n") {
if strings.HasPrefix(l, "panic:") || strings.HasPrefix(l, "fatal error:") {
stack = 30
}
if stack > 0 || strings.Contains(l, "_test.go:") || strings.HasPrefix(l, "--- FAIL") {
keep = append(keep, l)
}
if stack > 0 {
stack--
}
}
tail := string(out)
if len(tail) > 6000 {
tail = tail[len(tail)-6000:]
}
t.Fatalf("the SHIP test failed (%v):\n%s\n--- its output's end:\n%s", err, strings.Join(keep, "\n"), tail)
}
func TestSHIPInProcess(t *testing.T) {
if os.Getenv("EEBUS_SHIP_CHILD") != "1" {
t.Skip("run by TestSHIPControlBoxAndHeatPump")
}
dir := tempDir(t)
store, _ := OpenStore(dir) store, _ := OpenStore(dir)
signer, _ := LoadSigner(dir) signer, _ := LoadSigner(dir)
bridge := NewEEBUS(dir, 47120, "test", nil, true) bridge := NewEEBUS(dir, 47120, "test", nil, true)
@@ -235,10 +380,9 @@ func TestSHIPControlBoxAndHeatPump(t *testing.T) {
if err := bridge.Start(core); err != nil { if err := bridge.Start(core); err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer bridge.svc.Shutdown() t.Cleanup(bridge.Stop) // also the grid identity's process, which would go on writing into dir
// the grid operator's control box (eg/lpc as the energy guard) // the grid operator's control box (eg/lpc as the energy guard)
cbDir, hpDir := t.TempDir(), t.TempDir() cbDir, hpDir := tempDir(t), tempDir(t)
cb, cbSKI := newRemote(t, cbDir, 47131, model.DeviceTypeTypeElectricitySupplySystem, model.EntityTypeTypeGridGuard, "ControlBox") cb, cbSKI := newRemote(t, cbDir, 47131, model.DeviceTypeTypeElectricitySupplySystem, model.EntityTypeTypeGridGuard, "ControlBox")
cbLPC := eglpc.NewLPC(cb.svc.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard), nil) cbLPC := eglpc.NewLPC(cb.svc.LocalDevice().EntityForType(model.EntityTypeTypeGridGuard), nil)
cb.svc.AddUseCase(cbLPC) cb.svc.AddUseCase(cbLPC)
@@ -261,12 +405,16 @@ func TestSHIPControlBoxAndHeatPump(t *testing.T) {
// the bridge dials when the owner pairs; each device approves the // the bridge dials when the owner pairs; each device approves the
// bridge's request (as its installer or app does), so one side connects // bridge's request (as its installer or app does), so one side connects
cb.trust, hp.trust = bridge.LocalSKI(), bridge.GridSKI() // the control box pairs with the grid identity // Only the bridge dials: the devices do not know its SKIs before its
cb.svc.RegisterRemoteSKI(bridge.GridSKI()) // request, which each approves (registering the SKI only then). Both
hp.svc.RegisterRemoteSKI(bridge.LocalSKI()) // sides dialing at once is a double connection that ship-go closes in
// mid-handshake (ship-go v0.6.0's websocket then panicked: "send on
// closed channel"; fixed in third_party/ship-go).
cb.trust[bridge.LocalSKI()], cb.trust[bridge.GridSKI()] = true, true
hp.trust[bridge.LocalSKI()], hp.trust[bridge.GridSKI()] = true, true
for _, r := range []*remote{cb, hp} { for _, r := range []*remote{cb, hp} {
r.svc.Start() r.svc.Start()
defer r.svc.Shutdown() t.Cleanup(r.svc.Shutdown)
} }
// the owner pairs both on the page (after mDNS showed them) // the owner pairs both on the page (after mDNS showed them)
waitFor(t, "mDNS", 30*time.Second, func() bool { waitFor(t, "mDNS", 30*time.Second, func() bool {
@@ -310,18 +458,29 @@ func TestSHIPControlBoxAndHeatPump(t *testing.T) {
return target != nil return target != nil
}) })
// (once it has read the bridge's limit descriptions) // (once it has read the bridge's limit descriptions)
waitFor(t, "the control box's write", 30*time.Second, func() bool { // The control box writes until the bridge has the order: a write sent
// before its binding went through is denied ("write denied due to
// missing binding", e.g. just after the grid identity restarted to
// offer LPC), and a real control box writes again too.
lastWrite := time.Time{}
waitFor(t, "the grid order", 60*time.Second, func() bool {
core.mu.Lock()
limited := core.grid.State == "limited" && core.grid.LimitW == 4200
core.mu.Unlock()
if limited {
return true
}
if time.Since(lastWrite) < 3*time.Second {
return false
}
target = entityOf(cbLPC, bridge.GridSKI(), cb.svc.LocalDevice().RemoteDeviceForSki(bridge.GridSKI())) target = entityOf(cbLPC, bridge.GridSKI(), cb.svc.LocalDevice().RemoteDeviceForSki(bridge.GridSKI()))
if target == nil { if target == nil {
return false return false
} }
_, err := cbLPC.WriteConsumptionLimit(target, ucapi.LoadLimit{Value: 4200, IsActive: true, Duration: 10 * time.Minute}, nil) if _, err := cbLPC.WriteConsumptionLimit(target, ucapi.LoadLimit{Value: 4200, IsActive: true, Duration: 10 * time.Minute}, nil); err == nil {
return err == nil lastWrite = time.Now()
}) }
waitFor(t, "the grid order", 30*time.Second, func() bool { return false
core.mu.Lock()
defer core.mu.Unlock()
return core.grid.State == "limited" && core.grid.LimitW == 4200
}) })
if !core.IsControlBox(cbSKI) || core.IsControlBox(hpSKI) { if !core.IsControlBox(cbSKI) || core.IsControlBox(hpSKI) {
t.Fatal("the control box by its LPC") t.Fatal("the control box by its LPC")
@@ -332,7 +491,7 @@ func TestSHIPControlBoxAndHeatPump(t *testing.T) {
return err == nil && l.IsActive && l.Value == 4200 return err == nil && l.IsActive && l.Value == 4200
}) })
// the heat pump's limit stays protected: 0 W is refused // the heat pump's limit stays protected: 0 W is refused
if _, err := core.Command(core.devices[hpSKI].ID, "limit", "0", "test"); !errors.Is(err, ErrRefused) { if _, err := core.Command(hpID, "limit", "0", "test"); !errors.Is(err, ErrRefused) {
t.Fatalf("0 W: %v", err) t.Fatalf("0 W: %v", err)
} }
} }
+12
View File
@@ -33,3 +33,15 @@ require (
golang.org/x/tools v0.25.0 // indirect golang.org/x/tools v0.25.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )
// enbility's modules as patched copies (their latest releases have races
// that crashed or stalled the bridge): ship-go v0.6.0 (a write to a
// connection closed in mid-handshake, mDNS shut down under a closing
// connection, a close deadlocked with SPINE's locks, a panic contained to
// its connection), spine-go v0.7.0 and eebus-go v0.7.0 (data races).
// third_party/*/PATCHES.md. Drop each when a release has its fixes.
replace (
github.com/enbility/eebus-go => ./third_party/eebus-go
github.com/enbility/ship-go => ./third_party/ship-go
github.com/enbility/spine-go => ./third_party/spine-go
)
-8
View File
@@ -4,14 +4,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/eclipse/paho.mqtt.golang v1.5.0 h1:EH+bUVJNgttidWFkLLVKaQPGmkTUfQQqjOsyvMGvD6o= github.com/eclipse/paho.mqtt.golang v1.5.0 h1:EH+bUVJNgttidWFkLLVKaQPGmkTUfQQqjOsyvMGvD6o=
github.com/eclipse/paho.mqtt.golang v1.5.0/go.mod h1:du/2qNQVqJf/Sqs4MEL77kR8QTqANF7XU7Fk0aOTAgk= github.com/eclipse/paho.mqtt.golang v1.5.0/go.mod h1:du/2qNQVqJf/Sqs4MEL77kR8QTqANF7XU7Fk0aOTAgk=
github.com/enbility/eebus-go v0.7.0 h1:Uh3i+HMmTYecWA+BBlYYhNFuNtqzWWQarbv4z9n/aQI=
github.com/enbility/eebus-go v0.7.0/go.mod h1:ftoVhXGC00IEcfN4RZSb1PbBIglE9i3JYqwrjhXnYSA=
github.com/enbility/go-avahi v0.0.0-20240909195612-d5de6b280d7a h1:foChWb8lhzqa6lWDRs6COYMdp649YlUirFP8GqoT0JQ= github.com/enbility/go-avahi v0.0.0-20240909195612-d5de6b280d7a h1:foChWb8lhzqa6lWDRs6COYMdp649YlUirFP8GqoT0JQ=
github.com/enbility/go-avahi v0.0.0-20240909195612-d5de6b280d7a/go.mod h1:H64mhYcAQUGUUnVqMdZQf93kPecH4M79xwH95Lddt3U= github.com/enbility/go-avahi v0.0.0-20240909195612-d5de6b280d7a/go.mod h1:H64mhYcAQUGUUnVqMdZQf93kPecH4M79xwH95Lddt3U=
github.com/enbility/ship-go v0.6.0 h1:1ft5NJJHqqGU3/ryYwQj8xBYJLFbf0q2cP9mjlYHlgw=
github.com/enbility/ship-go v0.6.0/go.mod h1:JJp8EQcJhUhTpZ2LSEU4rpdaM3E2n08tswWFWtmm/wU=
github.com/enbility/spine-go v0.7.0 h1:UZeghFgnM3VFU0ghc57Htt6gnxwP9jLppfU2GUMJGgY=
github.com/enbility/spine-go v0.7.0/go.mod h1:IF1sBTr7p3wXqlejeBJcJ8BYFlzzRaZcJsGw8XjgEgc=
github.com/enbility/zeroconf/v2 v2.0.0-20240920094356-be1cae74fda6 h1:XOYvxKtT1oxT37w/5oEiRLuPbm9FuJPt3fiYhX0h8Po= github.com/enbility/zeroconf/v2 v2.0.0-20240920094356-be1cae74fda6 h1:XOYvxKtT1oxT37w/5oEiRLuPbm9FuJPt3fiYhX0h8Po=
github.com/enbility/zeroconf/v2 v2.0.0-20240920094356-be1cae74fda6/go.mod h1:BszP9qFV14mPXgyIREbgIdQtWxbAj3OKqvK02HihMoM= github.com/enbility/zeroconf/v2 v2.0.0-20240920094356-be1cae74fda6/go.mod h1:BszP9qFV14mPXgyIREbgIdQtWxbAj3OKqvK02HihMoM=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
@@ -38,8 +32,6 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a h1:DxppxFKRqJ8WD6oJ3+ZXKDY0iMONQDl5UTg2aTyHh8k= gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a h1:DxppxFKRqJ8WD6oJ3+ZXKDY0iMONQDl5UTg2aTyHh8k=
gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a/go.mod h1:NREvu3a57BaK0R1+ztrEzHWiZAihohNLQ6trPxlIqZI= gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a/go.mod h1:NREvu3a57BaK0R1+ztrEzHWiZAihohNLQ6trPxlIqZI=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
+49 -2
View File
@@ -9,6 +9,7 @@ import (
"log" "log"
"os" "os"
"os/exec" "os/exec"
"runtime/debug"
"strings" "strings"
"sync" "sync"
"time" "time"
@@ -64,6 +65,35 @@ type gridLink struct {
// box reads a device's use cases when it connects: when this changes // box reads a device's use cases when it connects: when this changes
// the child starts again, so the control box sees it (docs/parameters.md U3). // the child starts again, so the control box sees it (docs/parameters.md U3).
offered bool offered bool
cmd *exec.Cmd
stopped bool
}
// stop: ends the child for good (no restart); the tests, and a clean exit.
func (g *gridLink) stop() {
g.mu.Lock()
g.stopped = true
cmd := g.cmd
g.mu.Unlock()
if cmd != nil && cmd.Process != nil {
_ = cmd.Process.Kill()
}
}
func (g *gridLink) isStopped() bool {
g.mu.Lock()
defer g.mu.Unlock()
return g.stopped
}
// Stop: the grid identity's process and the bridge's own service.
func (e *EEBUS) Stop() {
if e.grid != nil {
e.grid.stop()
}
if e.svc != nil {
e.svc.Shutdown()
}
} }
// startGrid: the child, started again whenever it ends (its pairings sent // startGrid: the child, started again whenever it ends (its pairings sent
@@ -76,7 +106,13 @@ func startGrid(e *EEBUS, paired []string) (*gridLink, error) {
first := make(chan error, 1) first := make(chan error, 1)
go func() { go func() {
for n := 0; ; n++ { for n := 0; ; n++ {
if g.isStopped() {
return
}
err := g.run(first) err := g.run(first)
if g.isStopped() {
return
}
log.Printf("EEBUS grid identity ended (%v): starting it again", err) log.Printf("EEBUS grid identity ended (%v): starting it again", err)
time.Sleep(time.Duration(min(n+1, 30)) * time.Second) time.Sleep(time.Duration(min(n+1, 30)) * time.Second)
} }
@@ -114,6 +150,10 @@ func (g *gridLink) run(first chan error) error {
} }
nominal, _ := g.e.core.NominalW() nominal, _ := g.e.core.NominalW()
g.mu.Lock() g.mu.Lock()
g.cmd = cmd
if g.stopped {
_ = cmd.Process.Kill()
}
g.stdin, g.in = json.NewEncoder(in), in g.stdin, g.in = json.NewEncoder(in), in
for ski := range g.paired { for ski := range g.paired {
_ = g.stdin.Encode(gridMsg{Cmd: "pair", SKI: ski}) _ = g.stdin.Encode(gridMsg{Cmd: "pair", SKI: ski})
@@ -138,12 +178,19 @@ func (g *gridLink) run(first chan error) error {
} }
func (g *gridLink) handle(m gridMsg, first chan error) { func (g *gridLink) handle(m gridMsg, first chan error) {
// a panic handling one message is logged; the link and the bridge go
// on (the child resends the control box's values every 5 s)
defer func() {
if r := recover(); r != nil {
log.Printf("EEBUS grid identity: %s from %s panicked: %v\n%s", m.Ev, m.SKI, r, debug.Stack())
}
}()
c := g.e.core c := g.e.core
switch m.Ev { switch m.Ev {
case "ski": case "ski":
g.e.mu.Lock() g.e.smu.Lock()
g.e.gridSKI = m.SKI g.e.gridSKI = m.SKI
g.e.mu.Unlock() g.e.smu.Unlock()
select { select {
case first <- nil: case first <- nil:
default: default:
+9 -1
View File
@@ -43,6 +43,9 @@ type Config struct {
ReadOnly bool ReadOnly bool
NoControl bool // no consent to control (consent.go) NoControl bool // no consent to control (consent.go)
PassOn bool PassOn bool
// the pass-on check (Options; 0: the defaults in core.go)
PassOnToleranceW float64
PassOnRetryMax time.Duration
Interfaces []string Interfaces []string
Node string Node string
MQTTHost string MQTTHost string
@@ -83,6 +86,10 @@ func configFromEnv() Config {
if s := os.Getenv("INTERFACES"); s != "" { if s := os.Getenv("INTERFACES"); s != "" {
c.Interfaces = strings.Split(s, ",") c.Interfaces = strings.Split(s, ",")
} }
c.PassOnToleranceW, _ = strconv.ParseFloat(os.Getenv("PASS_ON_TOLERANCE_W"), 64)
if s, err := strconv.Atoi(os.Getenv("PASS_ON_RETRY_MAX_S")); err == nil && s > 0 {
c.PassOnRetryMax = time.Duration(s) * time.Second
}
return c return c
} }
@@ -198,7 +205,8 @@ func main() {
} else { } else {
backend = NewEEBUS(cfg.DataDir, cfg.Port, cfg.Serial, cfg.Interfaces, true) backend = NewEEBUS(cfg.DataDir, cfg.Port, cfg.Serial, cfg.Interfaces, true)
} }
core := NewCore(Options{Node: cfg.Node, PassOn: cfg.PassOn, ReadOnly: cfg.ReadOnly, NoControl: cfg.NoControl}, store, backend, profiles, signer) core := NewCore(Options{Node: cfg.Node, PassOn: cfg.PassOn, ReadOnly: cfg.ReadOnly, NoControl: cfg.NoControl,
PassOnToleranceW: cfg.PassOnToleranceW, PassOnRetryMax: cfg.PassOnRetryMax}, store, backend, profiles, signer)
opts := paho.NewClientOptions().AddBroker(fmt.Sprintf("tcp://%s:%d", cfg.MQTTHost, cfg.MQTTPort)). opts := paho.NewClientOptions().AddBroker(fmt.Sprintf("tcp://%s:%d", cfg.MQTTHost, cfg.MQTTPort)).
SetClientID("cantabile-eebus-bridge").SetUsername(cfg.MQTTUser).SetPassword(cfg.MQTTPass). SetClientID("cantabile-eebus-bridge").SetUsername(cfg.MQTTUser).SetPassword(cfg.MQTTPass).
+9 -4
View File
@@ -4,14 +4,17 @@
# and their licence files. Run where Go and the module cache are, in this # and their licence files. Run where Go and the module cache are, in this
# directory (e.g. in golang:1.26), after a dependency change. # directory (e.g. in golang:1.26), after a dependency change.
set -eu set -eu
mods=$(go list -deps -f '{{with .Module}}{{.Path}}@{{.Version}}{{end}}' . | sort -u | grep -v '^git.setti') # a module replaced by a patched copy (go.mod: third_party/<name>) is
# path@version@patched; its licence is read from that copy
mods=$(go list -deps -f '{{with .Module}}{{.Path}}@{{.Version}}{{if .Replace}}@patched{{end}}{{end}}' . | sort -u | grep -v '^git.setti')
cache=$(go env GOMODCACHE) cache=$(go env GOMODCACHE)
{ {
echo "# Third-party notices: Cantabile EEBUS bridge"; echo echo "# Third-party notices: Cantabile EEBUS bridge"; echo
echo "Copyright © 2026 Setti Solutions S.R.L, www.setti.md. The Cantabile EEBUS bridge links the open-source Go modules below (go list -deps of the bridge; regenerate with notices.sh). Their licences permit use, modification and redistribution in binary form when these notices are included."; echo echo "Copyright © 2026 Setti Solutions S.R.L, www.setti.md. The Cantabile EEBUS bridge links the open-source Go modules below (go list -deps of the bridge; regenerate with notices.sh). Their licences permit use, modification and redistribution in binary form when these notices are included. Modules marked patched are built from a modified copy in third_party/ (its PATCHES.md lists the changes, published under the module's own licence)."; echo
echo "| Module | Version | Licence |"; echo "|---|---|---|" echo "| Module | Version | Licence |"; echo "|---|---|---|"
for m in $mods; do for m in $mods; do
p=${m%@*}; v=${m#*@} p=${m%%@*}; v=${m#*@}
case $v in *@patched) v="${v%@patched}, patched (third_party/${p##*/})" ;; esac
case $p in case $p in
github.com/ahmetb/go-linq/v3) l="Apache-2.0" ;; github.com/ahmetb/go-linq/v3) l="Apache-2.0" ;;
github.com/eclipse/paho.mqtt.golang) l="EPL-2.0 or EDL-1.0 (BSD-3-Clause); used under EDL-1.0" ;; github.com/eclipse/paho.mqtt.golang) l="EPL-2.0 or EDL-1.0 (BSD-3-Clause); used under EDL-1.0" ;;
@@ -23,7 +26,9 @@ for m in $mods; do
echo "| $p | $v | $l |" echo "| $p | $v | $l |"
done; echo done; echo
for m in $mods; do for m in $mods; do
d=$cache/$m; echo "## ${m%@*} ${m#*@}"; echo; echo '```'; cat "$d/LICENSE" p=${m%%@*}; v=${m#*@}; d=$cache/$p@$v
case $v in *@patched) v=${v%@patched}; d=third_party/${p##*/} ;; esac
echo "## $p $v"; echo; echo '```'; cat "$d/LICENSE"
[ -f "$d/edl-v10" ] && { echo; echo "--- EDL-1.0 (edl-v10) ---"; cat "$d/edl-v10"; } [ -f "$d/edl-v10" ] && { echo; echo "--- EDL-1.0 (edl-v10) ---"; cat "$d/edl-v10"; }
echo '```'; echo echo '```'; echo
done done
+250
View File
@@ -0,0 +1,250 @@
// Copyright © 2026 Setti Solutions S.R.L, www.setti.md. All rights reserved.
package main
import (
"fmt"
"log"
"runtime"
"runtime/debug"
"strings"
"sync"
"sync/atomic"
"time"
)
// Contained panics in the bridge's work for a device (EEBUS.guard). A panic
// that repeats (the same site on every 5 s poll) is logged with its stack
// and shown as an event once per PanicReportEvery, with the count of
// repeats meanwhile. A device other than the grid operator's control box
// has its connection renewed (dropped; it connects again) once it panicked
// PanicRenewAfter times within PanicRenewWindow (the first panics only log
// and count), then again after PanicReconnectFirst, doubling up to
// PanicReconnectMax while it goes on; the back-off ends only after a whole
// PanicRenewWindow without a panic (a run that ends normally in between
// doesn't end it: a device alternating panics and normal runs isn't dropped
// every few seconds). The control box never: dropping it would set it
// offline and move the §14a limit to its failsafe (for up to 2 h) over a
// bug of ours; it gets the log, the event and the count only. The defaults
// are the bridge's own engineering values (docs/parameters.md E9c).
const (
PanicReportEvery = 10 * time.Minute
PanicRenewAfter = 5
PanicRenewWindow = 10 * time.Minute
PanicReconnectFirst = time.Minute
PanicReconnectMax = 30 * time.Minute
// the most panic sites and works kept (the oldest dropped beyond)
panicSitesMax = 64
panicWorksMax = 256
)
// panicSite: one place in the code (the top frames of the stack, without
// the panic's value), for the rate limit.
type panicSite struct {
reported time.Time // last logged with its stack and shown as an event
repeats int // since then
total int
}
// panicWork: the panics of one work for one device (ski, what).
type panicWork struct {
recent []time.Time // the panics within PanicRenewWindow (at most PanicRenewAfter)
reconnect time.Time // the next renewal allowed
renewals int
last time.Time // the last panic
active bool // counted in panicLog.active
sites map[string]*panicSite
}
type panicLog struct {
mu sync.Mutex
active atomic.Int32 // works with a panic within PanicRenewWindow: ok's fast path when 0
works map[string]*panicWork
reported int // panics reported in all (a counter for the page's log)
}
func workKey(ski, what string) string { return strings.ToLower(ski) + "|" + what }
// panicSiteOf: the panicking code's place: the first frames below the panic
// that aren't the runtime's or this file's, as function and line (no values,
// so a panic whose value changes (an index, a time) is one site).
func panicSiteOf(skip int) string {
pcs := make([]uintptr, 32)
n := runtime.Callers(skip, pcs)
frames := runtime.CallersFrames(pcs[:n])
parts := []string{}
for {
f, more := frames.Next()
if !strings.HasPrefix(f.Function, "runtime.") && !strings.Contains(f.File, "/panics.go") {
parts = append(parts, fmt.Sprintf("%s:%d", f.Function, f.Line))
if len(parts) == 3 {
break
}
}
if !more {
break
}
}
return strings.Join(parts, " < ")
}
// record: the panic counted; report: log its stack and raise the event now
// (repeats: how many of this site were not reported since its last report);
// renew: renew the device's connection now (never done for the control
// box: afterPanic).
func (p *panicLog) record(ski, what, site string, now time.Time) (report bool, repeats int, renew bool) {
p.mu.Lock()
defer p.mu.Unlock()
if p.works == nil {
p.works = map[string]*panicWork{}
}
key := workKey(ski, what)
w := p.works[key]
if w == nil {
if len(p.works) >= panicWorksMax {
p.dropOldestWork()
}
w = &panicWork{sites: map[string]*panicSite{}}
p.works[key] = w
}
if !w.last.IsZero() && now.Sub(w.last) >= PanicRenewWindow {
// a whole window without a panic: a new start
w.recent, w.renewals, w.reconnect = nil, 0, time.Time{}
}
w.last = now
if !w.active {
w.active = true
p.active.Add(1)
}
kept := w.recent[:0]
for _, at := range w.recent {
if now.Sub(at) < PanicRenewWindow {
kept = append(kept, at)
}
}
w.recent = append(kept, now)
if len(w.recent) > PanicRenewAfter {
w.recent = w.recent[len(w.recent)-PanicRenewAfter:]
}
s := w.sites[site]
if s == nil {
if len(w.sites) >= panicSitesMax {
dropOldestSite(w.sites)
}
s = &panicSite{}
w.sites[site] = s
}
s.total++
if s.reported.IsZero() || now.Sub(s.reported) >= PanicReportEvery {
report, repeats = true, s.repeats
s.reported, s.repeats = now, 0
p.reported++
} else {
s.repeats++
}
if len(w.recent) >= PanicRenewAfter && !now.Before(w.reconnect) {
renew = true
wait := PanicReconnectFirst << w.renewals
if wait > PanicReconnectMax || wait <= 0 {
wait = PanicReconnectMax
}
w.renewals++
w.reconnect = now.Add(wait)
}
return report, repeats, renew
}
// ok: the work for this device ended normally. Its renewal back-off ends
// only after a whole PanicRenewWindow without a panic. O(1), and without
// the lock when no work had a panic within the window.
func (p *panicLog) ok(ski, what string, now time.Time) {
if p.active.Load() == 0 {
return
}
p.mu.Lock()
defer p.mu.Unlock()
if w := p.works[workKey(ski, what)]; w != nil && w.active && now.Sub(w.last) >= PanicRenewWindow {
w.recent, w.renewals, w.reconnect, w.active = nil, 0, time.Time{}, false
p.active.Add(-1)
}
}
func (p *panicLog) dropOldestWork() {
oldest := ""
for k, w := range p.works {
if oldest == "" || w.last.Before(p.works[oldest].last) {
oldest = k
}
}
if w := p.works[oldest]; w != nil && w.active {
p.active.Add(-1)
}
delete(p.works, oldest)
}
func dropOldestSite(sites map[string]*panicSite) {
oldest := ""
for k, s := range sites {
if oldest == "" || s.reported.Before(sites[oldest].reported) {
oldest = k
}
}
delete(sites, oldest)
}
// guard: a panic in the work for one device (the bridge's or the library's
// under it) is contained (panicLog, afterPanic). (Panics on a connection's
// own goroutines end that connection in ship-go's websocket,
// third_party/ship-go.)
func (e *EEBUS) guard(ski, what string, f func()) {
defer func() {
r := recover()
if r == nil {
e.panics.ok(ski, what, time.Now())
return
}
// skip runtime.Callers, panicSiteOf and this deferred function
site := panicSiteOf(3)
report, repeats, renew := e.panics.record(ski, what, site, time.Now())
if report {
log.Printf("EEBUS: %s for %s panicked at %s (%d more since the last report): %v\n%s",
what, ski, site, repeats, r, debug.Stack())
}
go e.afterPanic(ski, what, r, report, repeats, renew)
}()
f()
}
// afterPanic: on its own goroutine, and never waiting for the core's lock
// for long (the panic may have left it held): the event when reported; the
// device's connection dropped, or renewed after repeats; the control box's
// never (it keeps its link: only the log, the event and the count).
func (e *EEBUS) afterPanic(ski, what string, r any, report bool, repeats int, renew bool) {
defer func() {
if r := recover(); r != nil {
log.Printf("EEBUS: after a panic for %s: %v", ski, r)
}
}()
if report && e.core != nil {
e.core.InternalError(ski, what, r, repeats)
}
if ski == "" || !renew || e.isControlBox(ski) {
return
}
log.Printf("EEBUS: %s for %s panicked: renewing its connection", what, ski)
if e.drop != nil {
e.drop(ski)
} else if e.svc != nil {
e.disconnect(ski)
}
}
// isControlBox: whether ski is the paired control box, lock-free (the
// core's record of it, kept where pairings and kinds change).
func (e *EEBUS) isControlBox(ski string) bool {
if e.core == nil {
return false
}
cb := e.core.ControlBoxSKINow()
return cb != "" && strings.EqualFold(cb, ski)
}
+22
View File
@@ -0,0 +1,22 @@
MIT license
Copyright (c) 2022 Andreas Linde & Timo Vogel
Copyright (c) 2023-2024 Andreas Linde
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+17
View File
@@ -0,0 +1,17 @@
# eebus-go v0.7.0, patched
This directory is [enbility/eebus-go](https://github.com/enbility/eebus-go) at
v0.7.0 (the module as published, without its tests, examples, example keys
and CI files), with the fixes below. The original is MIT-licensed (LICENSE,
unchanged). The modifications are Copyright © 2026 Setti Solutions S.R.L,
www.setti.md, and are published under the same MIT licence. The EEBUS bridge
uses this copy through a `replace` in its go.mod; drop it when an eebus-go
release has these fixes (v0.7.0 is the latest release as of 2026-11-13).
| File | Change |
|---|---|
| `usecases/cs/lpc/{usecase,events,public}.go`, `usecases/cs/lpp/…` (the same code) | `heartbeatDiag` and `heartbeatKeoWorkaround` under a lock. SPINE delivers events to the use cases on their own goroutines (`go HandleEvent`), so two devices connecting at once wrote them concurrently (`deviceConnected`), and `IsHeartbeatWithinDuration` read them meanwhile: data races (go test -race). |
Tests: `usecases/cs/lpc/heartbeat_race_test.go`, `usecases/cs/lpp/heartbeat_race_test.go`
(`go test -race ./usecases/cs/lpc ./usecases/cs/lpp`; `../go.work` builds them
against the patched ship-go and spine-go).
+108
View File
@@ -0,0 +1,108 @@
package api
import (
"github.com/enbility/ship-go/logging"
shipapi "github.com/enbility/ship-go/api"
spineapi "github.com/enbility/spine-go/api"
)
//go:generate mockery
/* Service */
// central service interface
//
// implemented by service, used by the eebus service implementation
type ServiceInterface interface {
// setup the service
Setup() error
// start the service
Start()
// shutdown the service
Shutdown()
// add a use case to the service
AddUseCase(useCase UseCaseInterface)
// set logging interface
SetLogging(logger logging.LoggingInterface)
// return the configuration
Configuration() *Configuration
// return the local service details
LocalService() *shipapi.ServiceDetails
// return the local device
LocalDevice() spineapi.DeviceLocalInterface
// Passthough functions to HubInterface
// Provide the current pairing state for a SKI
PairingDetailForSki(ski string) *shipapi.ConnectionStateDetail
// Defines wether incoming pairing requests should be automatically accepted or not
//
// Default: false
SetAutoAccept(value bool)
// Returns if the service has auto accept enabled or not
IsAutoAcceptEnabled() bool
// Returns the Service detail of a remote SKI
RemoteServiceForSKI(ski string) *shipapi.ServiceDetails
// Sets the SKI as being paired
RegisterRemoteSKI(ski string)
// Sets the SKI as not being paired
UnregisterRemoteSKI(ski string)
// Disconnect from a connected remote SKI
DisconnectSKI(ski string, reason string)
// Cancels the pairing process for a SKI
//
// This should be called while the service is running and the end
// user wants to cancel/disallow an incoming pairing request
CancelPairingWithSKI(ski string)
// Define wether the user is able to react to an incoming pairing request
//
// Call this with `true` e.g. if the user is currently using a web interface
// where an incoming request can be accepted or denied
//
// Default is set to false, meaning every incoming pairing request will be
// automatically denied
UserIsAbleToApproveOrCancelPairingRequests(allow bool)
}
// interface for receiving data for specific events from Service
//
// some are passthrough readers, because service needs to coordinate
// everything with SPINE
//
// implemented by the eebus service implementation, used by service
type ServiceReaderInterface interface {
// report a connection to a SKI
RemoteSKIConnected(service ServiceInterface, ski string)
// report a disconnection to a SKI
RemoteSKIDisconnected(service ServiceInterface, ski string)
// report all currently visible EEBUS services
VisibleRemoteServicesUpdated(service ServiceInterface, entries []shipapi.RemoteService)
// Provides the SHIP ID the remote service reported during the handshake process
// This needs to be persisted and passed on for future remote service connections
// when using `PairRemoteService`
ServiceShipIDUpdate(ski string, shipdID string)
// Provides the current pairing state for the remote service
// This is called whenever the state changes and can be used to
// provide user information for the pairing/connection process
ServicePairingDetailUpdate(ski string, detail *shipapi.ConnectionStateDetail)
}
@@ -0,0 +1,241 @@
package api
import (
"crypto/tls"
"fmt"
"time"
"github.com/enbility/ship-go/mdns"
"github.com/enbility/spine-go/model"
)
const defaultPort int = 4711
// defines requires meta information about this service
type Configuration struct {
// The vendors IANA PEN, optional but highly recommended.
// If not set, brand will be used instead
// Used for the Device Address: SPINE - Protocol Specification 7.1.1.2
vendorCode string
// The deviceBrand of the device, required
// Used for the Device Address: SPINE - Protocol Specification 7.1.1.2
// Used for mDNS txt record: SHIP - Specification 7.3.2
deviceBrand string
// The device model, required
// Used for the Device Address: SPINE - Protocol Specification 7.1.1.2
// Used for mDNS txt record: SHIP - Specification 7.3.2
deviceModel string
// Serial number of the device, required
// Used for the Device Address: SPINE - Protocol Specification 7.1.1.2
deviceSerialNumber string
// An alternate mDNS service identifier
// Optional, if not set will be generated using "Brand-Model-SerialNumber"
// Used for mDNS service and SHIP identifier: SHIP - Specification 7.2
alternateIdentifier string
// An alternate mDNS service name
// Optional, if not set will be identical to alternateIdentifier or generated using "Brand-Model-SerialNumber"
alternateMdnsServiceName string
// SPINE device type of the device model, required
// Used for SPINE device type
// Used for mDNS txt record: SHIP - Specification 7.3.2
deviceType model.DeviceTypeType
// SPINE device network feature set type, optional
// SPINE Protocol Specification 6
featureSet model.NetworkManagementFeatureSetType
// SPINE entity types for each entity that should be created
// Each entity has to have a different type!
entityTypes []model.EntityTypeType
// Network interface to use for the service
// Optional, if not set all detected interfaces will be used
interfaces []string
// The port address of the websocket server, required
port int
// The certificate used for the service and its connections, required
certificate tls.Certificate
// The timeout to be used for sending heartbeats and applied to all
// local entities created on setup the service
heartbeatTimeout time.Duration
// Optional set which mDNS providers should be used
mdnsProviderSelection mdns.MdnsProviderSelection
}
// Setup a Configuration with the required parameters
func NewConfiguration(
vendorCode,
deviceBrand,
deviceModel,
serialNumber string,
deviceType model.DeviceTypeType,
entityTypes []model.EntityTypeType,
port int,
certificate tls.Certificate,
heartbeatTimeout time.Duration,
) (*Configuration, error) {
configuration := &Configuration{
certificate: certificate,
port: port,
heartbeatTimeout: heartbeatTimeout,
mdnsProviderSelection: mdns.MdnsProviderSelectionAll,
}
if port == 0 {
configuration.port = defaultPort
}
isRequired := "is required"
if len(vendorCode) == 0 {
return nil, fmt.Errorf("vendorCode %s", isRequired)
}
configuration.vendorCode = vendorCode
if len(deviceBrand) == 0 {
return nil, fmt.Errorf("brand %s", isRequired)
}
configuration.deviceBrand = deviceBrand
if len(deviceModel) == 0 {
return nil, fmt.Errorf("model %s", isRequired)
}
configuration.deviceModel = deviceModel
if len(serialNumber) == 0 {
return nil, fmt.Errorf("serialNumber %s", isRequired)
}
configuration.deviceSerialNumber = serialNumber
if len(deviceType) == 0 {
return nil, fmt.Errorf("deviceType %s", isRequired)
}
configuration.deviceType = deviceType
if len(entityTypes) == 0 {
return nil, fmt.Errorf("entityTypes %s", isRequired)
}
configuration.entityTypes = entityTypes
// set default
configuration.featureSet = model.NetworkManagementFeatureSetTypeSmart
return configuration, nil
}
func (s *Configuration) VendorCode() string {
return s.vendorCode
}
func (s *Configuration) DeviceBrand() string {
return s.deviceBrand
}
func (s *Configuration) DeviceModel() string {
return s.deviceModel
}
func (s *Configuration) DeviceSerialNumber() string {
return s.deviceSerialNumber
}
// define an alternative mDNS and SHIP identifier
// usually this is only used when no deviceCode is available or identical to the brand
// if this is not set, generated identifier is used
func (s *Configuration) SetAlternateIdentifier(identifier string) {
s.alternateIdentifier = identifier
}
// define an alternative mDNS service name
// this is normally not needed or used
func (s *Configuration) SetAlternateMdnsServiceName(name string) {
s.alternateMdnsServiceName = name
}
func (s *Configuration) SetMdnsProviderSelection(providerSelection mdns.MdnsProviderSelection) {
s.mdnsProviderSelection = providerSelection
}
func (s *Configuration) MdnsProviderSelection() mdns.MdnsProviderSelection {
return s.mdnsProviderSelection
}
func (s *Configuration) DeviceType() model.DeviceTypeType {
return s.deviceType
}
func (s *Configuration) FeatureSet() model.NetworkManagementFeatureSetType {
return s.featureSet
}
func (s *Configuration) EntityTypes() []model.EntityTypeType {
return s.entityTypes
}
func (s *Configuration) Interfaces() []string {
return s.interfaces
}
// define which network interfaces should be considered instead of all existing
// expects a list of network interface names
func (s *Configuration) SetInterfaces(ifaces []string) {
s.interfaces = ifaces
}
// generates a standard identifier used for mDNS ID and SHIP ID
// Brand-Model-SerialNumber
func (s *Configuration) generateIdentifier() string {
return fmt.Sprintf("%s-%s-%s", s.deviceBrand, s.deviceModel, s.deviceSerialNumber)
}
// return the identifier to be used for mDNS and SHIP ID
// returns in this order:
// - alternateIdentifier
// - generateIdentifier
func (s *Configuration) Identifier() string {
// SHIP identifier is identical to the mDNS ID
if len(s.alternateIdentifier) > 0 {
return s.alternateIdentifier
}
return s.generateIdentifier()
}
// return the name to be used as the mDNS service name
// returns in this order:
// - alternateMdnsServiceName
// - generateIdentifier
func (s *Configuration) MdnsServiceName() string {
// SHIP identifier is identical to the mDNS ID
if len(s.alternateMdnsServiceName) > 0 {
return s.alternateMdnsServiceName
}
return s.generateIdentifier()
}
func (s *Configuration) Certificate() tls.Certificate {
return s.certificate
}
func (s *Configuration) Port() int {
return s.port
}
func (s *Configuration) SetCertificate(cert tls.Certificate) {
s.certificate = cert
}
func (s *Configuration) HeartbeatTimeout() time.Duration {
return s.heartbeatTimeout
}
+29
View File
@@ -0,0 +1,29 @@
package api
import "errors"
// ErrMetadataNotAvailable indicates that the meta data information is not available
// e.g. decsriptions, constraints, ...
var ErrMetadataNotAvailable = errors.New("meta data not available")
// ErrDataNotAvailable indicates that no data set is yet available
var ErrDataNotAvailable = errors.New("data not available")
// ErrDataForMetadataKeyNotFound indicates that no data item is found for the given key
var ErrDataForMetadataKeyNotFound = errors.New("data for key not found")
var ErrNotSupported = errors.New("not supported")
var ErrEntityNotFound = errors.New("entity not found")
var ErrUsecCaseNotSupported = errors.New("usecase is not supported")
var ErrFunctionNotSupported = errors.New("function is not supported")
var ErrOperationOnFunctionNotSupported = errors.New("operation is not supported on function")
var ErrMissingData = errors.New("missing data")
var ErrDeviceDisconnected = errors.New("device is disconnected")
var ErrNoCompatibleEntity = errors.New("no compatible entity")
+244
View File
@@ -0,0 +1,244 @@
package api
import (
"time"
"github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
// Feature client interface were the local feature role is client and the remote feature role is server
type FeatureClientInterface interface {
// check if there is a subscription to the remote feature
HasSubscription() bool
// subscribe to the feature of the entity
Subscribe() (*model.MsgCounterType, error)
// check if there is a binding to the remote feature
HasBinding() bool
// bind to the feature of the entity
Bind() (*model.MsgCounterType, error)
// add a callback function to be invoked once a result or reply message for a msgCounter came in
AddResponseCallback(msgCounterReference model.MsgCounterType, function func(msg api.ResponseMessage)) error
// add a callback function to be invoked once a result came in
AddResultCallback(function func(msg api.ResponseMessage))
}
// Feature server interface were the local feature role is a server
type FeatureServerInterface interface {
}
// Common interface for DeviceClassificationClientInterface and DeviceClassificationServerInterface
type DeviceClassificationCommonInterface interface {
// get the current manufacturer details for a remote device entity
GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error)
}
// Common interface for DeviceConfigurationClientInterface and DeviceConfigurationServerInterface
type DeviceConfigurationCommonInterface interface {
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.DeviceConfigurationKeyValueListDataType,
// filter type will be checked for model.DeviceConfigurationKeyValueDescriptionDataType
CheckEventPayloadDataForFilter(payloadData any, filter any) bool
// Get the description for a given keyId
//
// Will return nil if no matching description was found
GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)
// Get the description for a given value combination
//
// Returns an error if no matching description was found
GetKeyValueDescriptionsForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)
// Get the key value data for a given keyId
//
// Will return nil if no matching data was found
GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)
// Get key value data for a given filter
//
// Will return nil if no matching data was found
GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)
}
// Common interface for DeviceDiagnosisClientInterface and DeviceDiagnosisServerInterface
type DeviceDiagnosisCommonInterface interface {
// get the current diagnosis state for an device entity
GetState() (*model.DeviceDiagnosisStateDataType, error)
// check if the currently available heartbeat data is within a time duration
IsHeartbeatWithinDuration(duration time.Duration) bool
}
// Common interface for ElectricalConnectionClientInterface and ElectricalConnectionServerInterface
type ElectricalConnectionCommonInterface interface {
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.ElectricalConnectionPermittedValueSetListDataType,
// filter type will be checked for model.ElectricalConnectionParameterDescriptionDataType
CheckEventPayloadDataForFilter(payloadData any, filter any) bool
// Get the description for a given filter
//
// Returns an error if no matching description is found
GetDescriptionsForFilter(
filter model.ElectricalConnectionDescriptionDataType,
) ([]model.ElectricalConnectionDescriptionDataType, error)
// Get the description for a given parameter description
//
// Returns an error if no matching description is found
GetDescriptionForParameterDescriptionFilter(
filter model.ElectricalConnectionParameterDescriptionDataType) (
*model.ElectricalConnectionDescriptionDataType, error)
// Get the description for a given filter
//
// Returns an error if no matching description is found
GetParameterDescriptionsForFilter(
filter model.ElectricalConnectionParameterDescriptionDataType,
) ([]model.ElectricalConnectionParameterDescriptionDataType, error)
// return permitted values for all Electrical Connections
GetPermittedValueSetForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (
[]model.ElectricalConnectionPermittedValueSetDataType, error)
// returns minimum, maximum, default/pause limit values
GetPermittedValueDataForFilter(filter model.ElectricalConnectionPermittedValueSetDataType) (
float64, float64, float64, error)
// Get the min, max, default current limits for each phase
GetPhaseCurrentLimits(measDesc []model.MeasurementDescriptionDataType) (
resultMin []float64, resultMax []float64, resultDefault []float64, resultErr error)
// Adjust a value to be within the permitted value range
AdjustValueToBeWithinPermittedValuesForParameterId(
value float64, parameterId model.ElectricalConnectionParameterIdType) float64
// Get the characteristics for a given filter
//
// Returns an error if no matching description is found
GetCharacteristicsForFilter(
filter model.ElectricalConnectionCharacteristicDataType,
) ([]model.ElectricalConnectionCharacteristicDataType, error)
}
// Common interface for LoadControlClientInterface and LoadControlServerInterface
type LoadControlCommonInterface interface {
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.LoadControlLimitListDataType,
// filter type will be checked for model.LoadControlLimitDescriptionDataType
CheckEventPayloadDataForFilter(payloadData any, filter any) bool
// Get the description for a given limitId
//
// Will return nil if no matching description is found
GetLimitDescriptionForId(limitId model.LoadControlLimitIdType) (
*model.LoadControlLimitDescriptionDataType, error)
// Get the description for a given filter
//
// Returns an error if no matching description is found
GetLimitDescriptionsForFilter(
filter model.LoadControlLimitDescriptionDataType,
) ([]model.LoadControlLimitDescriptionDataType, error)
// Get the description for a given limitId
//
// Will return nil if no data is available
GetLimitDataForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)
// Get limit data for a given filter
//
// Will return nil if no data is available
GetLimitDataForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)
}
// Common interface for MeasurementClientInterface and MeasurementServerInterface
type MeasurementCommonInterface interface {
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.MeasurementListDataType,
// filter type will be checked for model.MeasurementDescriptionDataType
CheckEventPayloadDataForFilter(payloadData any, filter any) bool
// Get the description for a given id
//
// Returns an error if no matching description is found
GetDescriptionForId(
measurementId model.MeasurementIdType,
) (*model.MeasurementDescriptionDataType, error)
// Get the description for a given filter
//
// Returns an error if no matching description is found
GetDescriptionsForFilter(
filter model.MeasurementDescriptionDataType,
) ([]model.MeasurementDescriptionDataType, error)
// Get the constraints for a given filter
//
// Returns an error if no matching constraint is found
GetConstraintsForFilter(
filter model.MeasurementConstraintsDataType,
) ([]model.MeasurementConstraintsDataType, error)
// Get the measuement data for a given measurementId
//
// Will return nil if no data is available
GetDataForId(measurementId model.MeasurementIdType) (*model.MeasurementDataType, error)
// Get measuement data for a given filter
//
// Will return nil if no data is available
GetDataForFilter(filter model.MeasurementDescriptionDataType) (
[]model.MeasurementDataType, error)
}
// Common interface for IdentificationClientInterface and IdentificationServerInterface
type IdentificationCommonInterface interface {
// check if spine.EventPayload Data contains identification data
//
// data type will be checked for model.IdentificationListDataType
CheckEventPayloadDataForFilter(payloadData any) bool
// return current values for Identification
GetDataForFilter(filter model.IdentificationDataType) ([]model.IdentificationDataType, error)
}
// Common interface for IncentiveTableClientInterface and IncentiveTableServerInterface
type IncentiveTableCommonInterface interface {
// return list of descriptions for a given filter
GetDescriptionsForFilter(filter model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)
// return list of constraints
GetConstraints() ([]model.IncentiveTableConstraintsType, error)
// return current data for Time Series
GetData() ([]model.IncentiveTableType, error)
}
// Common interface for SmartEnergyManagementPsClientInterface and SmartEnergyManagementPsServerInterface
type SmartEnergyManagementPsCommonInterface interface {
// return current data for FunctionTypeSmartEnergyManagementPsData
GetData() (*model.SmartEnergyManagementPsDataType, error)
}
// Common interface for TimeSeriesClientInterface and TimeSeriesServerInterface
type TimeSeriesCommonInterface interface {
// return list of descriptions for a given filter
GetDescriptionsForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)
// return current constraints for Time Series
GetConstraints() ([]model.TimeSeriesConstraintsDataType, error)
// return current data for Time Series for a given filter
GetDataForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)
}
@@ -0,0 +1,167 @@
package api
import "github.com/enbility/spine-go/model"
type DeviceClassificationClientInterface interface {
// request DeviceClassificationManufacturerData from a remote device entity
RequestManufacturerDetails() (*model.MsgCounterType, error)
}
type DeviceConfigurationClientInterface interface {
DeviceConfigurationCommonInterface
// request DeviceConfigurationKeyValueDescriptionDataType from a remote entity
RequestKeyValueDescriptions(
selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType,
elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType,
) (*model.MsgCounterType, error)
// request DeviceConfigurationKeyValueListData from a remote entity
RequestKeyValues(
selector *model.DeviceConfigurationKeyValueListDataSelectorsType,
elements *model.DeviceConfigurationKeyValueDataElementsType,
) (*model.MsgCounterType, error)
// write key values
// returns an error if this failed
WriteKeyValues(data []model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error)
}
type DeviceDiagnosisClientInterface interface {
// request DeviceDiagnosisStateData from a remote entity
RequestState() (*model.MsgCounterType, error)
// request FunctionTypeDeviceDiagnosisHeartbeatData from a remote device
RequestHeartbeat() (*model.MsgCounterType, error)
}
type ElectricalConnectionClientInterface interface {
// request ElectricalConnectionDescriptionListDataType from a remote entity
RequestDescriptions(
selector *model.ElectricalConnectionDescriptionListDataSelectorsType,
elements *model.ElectricalConnectionDescriptionDataElementsType,
) (*model.MsgCounterType, error)
// request FunctionTypeElectricalConnectionParameterDescriptionListData from a remote entity
RequestParameterDescriptions(
selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType,
elements *model.ElectricalConnectionParameterDescriptionDataElementsType,
) (*model.MsgCounterType, error)
// request FunctionTypeElectricalConnectionPermittedValueSetListData from a remote entity
RequestPermittedValueSets(
selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType,
elements *model.ElectricalConnectionPermittedValueSetDataElementsType,
) (*model.MsgCounterType, error)
// request FunctionTypeElectricalConnectionCharacteristicListData from a remote entity
RequestCharacteristics(
selector *model.ElectricalConnectionCharacteristicListDataSelectorsType,
elements *model.ElectricalConnectionCharacteristicDataElementsType,
) (*model.MsgCounterType, error)
}
type IdentificationClientInterface interface {
// request FunctionTypeIdentificationListData from a remote entity
RequestValues() (*model.MsgCounterType, error)
}
type IncentiveTableClientInterface interface {
// request FunctionTypeIncentiveTableDescriptionData from a remote entity
RequestDescriptions() (*model.MsgCounterType, error)
// request FunctionTypeIncentiveTableConstraintsData from a remote entity
RequestConstraints() (*model.MsgCounterType, error)
// request FunctionTypeIncentiveTableData from a remote entity
RequestValues() (*model.MsgCounterType, error)
// write incentivetable descriptions
// returns an error if this failed
WriteDescriptions(data []model.IncentiveTableDescriptionType) (*model.MsgCounterType, error)
// write incentivetable descriptions
// returns an error if this failed
WriteValues(data []model.IncentiveTableType) (*model.MsgCounterType, error)
}
type LoadControlClientInterface interface {
// request FunctionTypeLoadControlLimitDescriptionListData from a remote device
RequestLimitDescriptions(
selector *model.LoadControlLimitDescriptionListDataSelectorsType,
elements *model.LoadControlLimitDescriptionDataElementsType,
) (*model.MsgCounterType, error)
// request FunctionTypeLoadControlLimitConstraintsListData from a remote device
RequestLimitConstraints(
selector *model.LoadControlLimitConstraintsListDataSelectorsType,
elements *model.LoadControlLimitConstraintsDataElementsType,
) (*model.MsgCounterType, error)
// request FunctionTypeLoadControlLimitListData from a remote device
RequestLimitData(
selector *model.LoadControlLimitListDataSelectorsType,
elements *model.LoadControlLimitDataElementsType,
) (*model.MsgCounterType, error)
// write load control limits
// returns an error if this failed
WriteLimitData(
data []model.LoadControlLimitDataType,
deleteSelectors *model.LoadControlLimitListDataSelectorsType,
deleteElements *model.LoadControlLimitDataElementsType,
) (*model.MsgCounterType, error)
}
type MeasurementClientInterface interface {
// request FunctionTypeMeasurementDescriptionListData from a remote device
RequestDescriptions(
selector *model.MeasurementDescriptionListDataSelectorsType,
elements *model.MeasurementDescriptionDataElementsType,
) (*model.MsgCounterType, error)
// request FunctionTypeMeasurementConstraintsListData from a remote entity
RequestConstraints(
selector *model.MeasurementConstraintsListDataSelectorsType,
elements *model.MeasurementConstraintsDataElementsType,
) (*model.MsgCounterType, error)
// request FunctionTypeMeasurementListData from a remote entity
RequestData(
selector *model.MeasurementListDataSelectorsType,
elements *model.MeasurementDataElementsType,
) (*model.MsgCounterType, error)
}
type SmartEnergyManagementPsClientInterface interface {
// request FunctionTypeSmartEnergyManagementPsData from a remote entity
RequestData() (*model.MsgCounterType, error)
// write SmartEnergyManagementPsData
// returns an error if this failed
WriteData(data *model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error)
}
type TimeSeriesClientInterface interface {
// request FunctionTypeTimeSeriesDescriptionListData from a remote entity
RequestDescriptions(
selector *model.TimeSeriesDescriptionListDataSelectorsType,
elements *model.TimeSeriesDescriptionDataElementsType,
) (*model.MsgCounterType, error)
// request FunctionTypeTimeSeriesConstraintsListData from a remote entity
RequestConstraints(
selector *model.TimeSeriesConstraintsListDataSelectorsType,
elements *model.TimeSeriesConstraintsDataElementsType,
) (*model.MsgCounterType, error)
// request FunctionTypeTimeSeriesListData from a remote device
RequestData(
selector *model.TimeSeriesListDataSelectorsType,
elements *model.TimeSeriesDataElementsType,
) (*model.MsgCounterType, error)
// write Time Series values
// returns an error if this failed
WriteData(data []model.TimeSeriesDataType) (*model.MsgCounterType, error)
}
@@ -0,0 +1,154 @@
package api
import "github.com/enbility/spine-go/model"
type DeviceClassificationServerInterface interface {
}
type DeviceConfigurationServerInterface interface {
DeviceConfigurationCommonInterface
// Add a new description data set and return the keyId
//
// will return nil if the data set could not be added
AddKeyValueDescription(description model.DeviceConfigurationKeyValueDescriptionDataType) *model.DeviceConfigurationKeyIdType
// Set or update data set for a keyId
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
UpdateKeyValueDataForKeyId(
data model.DeviceConfigurationKeyValueDataType,
deleteElements *model.DeviceConfigurationKeyValueDataElementsType,
keyId model.DeviceConfigurationKeyIdType,
) error
// Set or update data set for a filter
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
UpdateKeyValueDataForFilter(
data model.DeviceConfigurationKeyValueDataType,
deleteElements *model.DeviceConfigurationKeyValueDataElementsType,
filter model.DeviceConfigurationKeyValueDescriptionDataType,
) error
}
type DeviceDiagnosisServerInterface interface {
// set the local diagnosis state of the device
SetLocalState(operatingState *model.DeviceDiagnosisStateDataType)
}
type ElectricalConnectionServerInterface interface {
ElectricalConnectionCommonInterface
// Add a new description data set
//
// NOTE: the electricalConnectionId has to be provided
//
// will return nil if the data set could not be added
AddDescription(
description model.ElectricalConnectionDescriptionDataType,
) error
// Add a new parameter description data sett and return the parameterId
//
// NOTE: the electricalConnectionId has to be provided, parameterId may not be provided
//
// will return nil if the data set could not be added
AddParameterDescription(
description model.ElectricalConnectionParameterDescriptionDataType,
) *model.ElectricalConnectionParameterIdType
// Add a new characteristic data set
//
// Note: ElectricalConnectionId and ParameterId must be set, CharacteristicId will be set automatically
//
// Will return an error if the data set could not be added
AddCharacteristic(data model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error)
// Update data set for a filter
// Elements provided in deleteElements will be removed from the data set before the update
//
// // ElectricalConnectionId, ParameterId and CharacteristicId must be set
//
// Will return an error if the data set could not be updated
UpdateCharacteristic(
data model.ElectricalConnectionCharacteristicDataType,
deleteElements *model.ElectricalConnectionCharacteristicDataElementsType,
) error
}
type LoadControlServerInterface interface {
// Add a new description data set and return the limitId
//
// NOTE: the limitId may not be provided
//
// will return nil if the data set could not be added
AddLimitDescription(
description model.LoadControlLimitDescriptionDataType,
) *model.LoadControlLimitIdType
// Set or update data set for a limitId
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
UpdateLimitDataForId(
data model.LoadControlLimitDataType,
deleteElements *model.LoadControlLimitDataElementsType,
limitId model.LoadControlLimitIdType,
) error
// Set or update data set for a filter
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
UpdateLimitDataForFilter(
data model.LoadControlLimitDataType,
deleteElements *model.LoadControlLimitDataElementsType,
filter model.LoadControlLimitDescriptionDataType,
) error
}
type MeasurementServerInterface interface {
// Add a new parameter description data sett and return the measurementId
//
// NOTE: the measurementId may not be provided
//
// will return nil if the data set could not be added
AddDescription(
description model.MeasurementDescriptionDataType,
) *model.MeasurementIdType
// Set or update data set for a measurementId
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
UpdateDataForId(
data model.MeasurementDataType,
deleteElements *model.MeasurementDataElementsType,
measurementId model.MeasurementIdType,
) error
// Set or update data set for a filter
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
UpdateDataForFilter(
data model.MeasurementDataType,
deleteElements *model.MeasurementDataElementsType,
filter model.MeasurementDescriptionDataType,
) error
}
type IdentificationServerInterface interface {
}
type IncentiveTableServerInterface interface {
}
type SmartEnergyManagementPsServerInterface interface {
}
type TimeSeriesServerInterface interface {
}
+4
View File
@@ -0,0 +1,4 @@
package api
// type for cem and usecase specfic event names
type EventType string
+76
View File
@@ -0,0 +1,76 @@
package api
import (
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
// details about each use case scenario
type UseCaseScenario struct {
Scenario model.UseCaseScenarioSupportType // the scenario number
Mandatory bool // if this scenario is mandatory to be supported by the remote entity
ServerFeatures []model.FeatureTypeType // the server features required for this scenario on the remote entity
}
// contains the available scenarios of a remote entity
type RemoteEntityScenarios struct {
Entity spineapi.EntityRemoteInterface
Scenarios []uint
}
// Entity event callback
//
// Used by Use Case implementations
type EntityEventCallback func(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event EventType)
type UseCaseBaseInterface interface {
// add the use case
AddUseCase()
// remove the use case
RemoveUseCase()
// update availability of the use case
//
// NOTE: only allowed to be used for client side implementations
// of a use case! Otherwise use `RemoveUseCase` and `AddUseCase`.
UpdateUseCaseAvailability(available bool)
// check if the entity is compatible with the use case
IsCompatibleEntityType(entity spineapi.EntityRemoteInterface) bool
// return the current list of compatible remote entities and their available scenarios of this use case
RemoteEntitiesScenarios() []RemoteEntityScenarios
// return the current list of available scenarios of this use case for the remote entity
AvailableScenariosForEntity(entity spineapi.EntityRemoteInterface) []uint
// check if the provided scenario are available at the remote entity
IsScenarioAvailableAtEntity(
entity spineapi.EntityRemoteInterface,
scenario uint,
) bool
}
// Implemented by each Use Case
type UseCaseInterface interface {
UseCaseBaseInterface
// add the features
AddFeatures()
}
type ManufacturerData struct {
DeviceName string `json:"deviceName,omitempty"`
DeviceCode string `json:"deviceCode,omitempty"`
SerialNumber string `json:"serialNumber,omitempty"`
SoftwareRevision string `json:"softwareRevision,omitempty"`
HardwareRevision string `json:"hardwareRevision,omitempty"`
VendorName string `json:"vendorName,omitempty"`
VendorCode string `json:"vendorCode,omitempty"`
BrandName string `json:"brandName,omitempty"`
PowerSource string `json:"powerSource,omitempty"`
ManufacturerNodeIdentification string `json:"manufacturerNodeIdentification,omitempty"`
ManufacturerLabel string `json:"manufacturerLabel,omitempty"`
ManufacturerDescription string `json:"manufacturerDescription,omitempty"`
}
@@ -0,0 +1,41 @@
package client
import (
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type DeviceClassification struct {
*Feature
*internal.DeviceClassificationCommon
}
// Get a new DeviceClassification features helper
//
// - The feature on the local entity has to be of role client
// - The feature on the remote entity has to be of role server
func NewDeviceClassification(
localEntity spineapi.EntityLocalInterface,
remoteEntity spineapi.EntityRemoteInterface) (*DeviceClassification, error) {
feature, err := NewFeature(model.FeatureTypeTypeDeviceClassification, localEntity, remoteEntity)
if err != nil {
return nil, err
}
dc := &DeviceClassification{
Feature: feature,
DeviceClassificationCommon: internal.NewRemoteDeviceClassification(feature.featureRemote),
}
return dc, nil
}
var _ api.DeviceClassificationClientInterface = (*DeviceClassification)(nil)
// request DeviceClassificationManufacturerData from a remote device entity
func (d *DeviceClassification) RequestManufacturerDetails() (*model.MsgCounterType, error) {
return d.requestData(model.FunctionTypeDeviceClassificationManufacturerData, nil, nil)
}
@@ -0,0 +1,90 @@
package client
import (
"github.com/enbility/eebus-go/api"
internal "github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
"github.com/enbility/spine-go/util"
)
type DeviceConfiguration struct {
*Feature
*internal.DeviceConfigurationCommon
}
// Get a new DeviceConfiguration features helper
//
// - The feature on the local entity has to be of role client
// - The feature on the remote entity has to be of role server
func NewDeviceConfiguration(
localEntity spineapi.EntityLocalInterface,
remoteEntity spineapi.EntityRemoteInterface) (*DeviceConfiguration, error) {
feature, err := NewFeature(model.FeatureTypeTypeDeviceConfiguration, localEntity, remoteEntity)
if err != nil {
return nil, err
}
dc := &DeviceConfiguration{
Feature: feature,
DeviceConfigurationCommon: internal.NewRemoteDeviceConfiguration(feature.featureRemote),
}
return dc, nil
}
var _ api.DeviceConfigurationClientInterface = (*DeviceConfiguration)(nil)
// request DeviceConfigurationKeyValueDescriptionDataType from a remote entity
func (d *DeviceConfiguration) RequestKeyValueDescriptions(
selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType,
elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType,
) (*model.MsgCounterType, error) {
return d.requestData(model.FunctionTypeDeviceConfigurationKeyValueDescriptionListData, selector, elements)
}
// request DeviceConfigurationKeyValueListData from a remote entity
func (d *DeviceConfiguration) RequestKeyValues(
selector *model.DeviceConfigurationKeyValueListDataSelectorsType,
elements *model.DeviceConfigurationKeyValueDataElementsType,
) (*model.MsgCounterType, error) {
return d.requestData(model.FunctionTypeDeviceConfigurationKeyValueListData, selector, elements)
}
// write key values
// returns an error if this failed
func (d *DeviceConfiguration) WriteKeyValues(data []model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error) {
if len(data) == 0 {
return nil, api.ErrMissingData
}
filters := []model.FilterType{*model.NewFilterTypePartial()}
// does the remote server feature not support partials?
operation := d.featureRemote.Operations()[model.FunctionTypeDeviceConfigurationKeyValueListData]
if operation == nil || !operation.WritePartial() {
filters = nil
// we need to send all data
updateData := &model.DeviceConfigurationKeyValueListDataType{
DeviceConfigurationKeyValueData: data,
}
if mergedData, err := d.featureRemote.UpdateData(false, model.FunctionTypeDeviceConfigurationKeyValueListData, updateData, nil, nil); err == nil {
data = mergedData.([]model.DeviceConfigurationKeyValueDataType)
}
}
cmd := model.CmdType{
DeviceConfigurationKeyValueListData: &model.DeviceConfigurationKeyValueListDataType{
DeviceConfigurationKeyValueData: data,
},
}
if filters != nil {
cmd.Filter = filters
cmd.Function = util.Ptr(model.FunctionTypeDeviceConfigurationKeyValueListData)
}
return d.remoteDevice.Sender().Write(d.featureLocal.Address(), d.featureRemote.Address(), cmd)
}
@@ -0,0 +1,46 @@
package client
import (
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type DeviceDiagnosis struct {
*Feature
*internal.DeviceDiagnosisCommon
}
// Get a new DeviceDiagnosis features helper
//
// - The feature on the local entity has to be of role client
// - The feature on the remote entity has to be of role server
func NewDeviceDiagnosis(
localEntity spineapi.EntityLocalInterface,
remoteEntity spineapi.EntityRemoteInterface) (*DeviceDiagnosis, error) {
feature, err := NewFeature(model.FeatureTypeTypeDeviceDiagnosis, localEntity, remoteEntity)
if err != nil {
return nil, err
}
dd := &DeviceDiagnosis{
Feature: feature,
DeviceDiagnosisCommon: internal.NewRemoteDeviceDiagnosis(feature.featureRemote),
}
return dd, nil
}
var _ api.DeviceDiagnosisClientInterface = (*DeviceDiagnosis)(nil)
// request DeviceDiagnosisStateData from a remote entity
func (d *DeviceDiagnosis) RequestState() (*model.MsgCounterType, error) {
return d.requestData(model.FunctionTypeDeviceDiagnosisStateData, nil, nil)
}
// request FunctionTypeDeviceDiagnosisHeartbeatData from a remote device
func (d *DeviceDiagnosis) RequestHeartbeat() (*model.MsgCounterType, error) {
return d.requestData(model.FunctionTypeDeviceDiagnosisHeartbeatData, nil, nil)
}
@@ -0,0 +1,68 @@
package client
import (
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type ElectricalConnection struct {
*Feature
*internal.ElectricalConnectionCommon
}
// Get a new ElectricalConnection features helper
//
// - The feature on the local entity has to be of role client
// - The feature on the remote entity has to be of role server
func NewElectricalConnection(
localEntity spineapi.EntityLocalInterface,
remoteEntity spineapi.EntityRemoteInterface) (*ElectricalConnection, error) {
feature, err := NewFeature(model.FeatureTypeTypeElectricalConnection, localEntity, remoteEntity)
if err != nil {
return nil, err
}
e := &ElectricalConnection{
Feature: feature,
ElectricalConnectionCommon: internal.NewRemoteElectricalConnection(feature.featureRemote),
}
return e, nil
}
var _ api.ElectricalConnectionClientInterface = (*ElectricalConnection)(nil)
// request ElectricalConnectionDescriptionListDataType from a remote entity
func (e *ElectricalConnection) RequestDescriptions(
selector *model.ElectricalConnectionDescriptionListDataSelectorsType,
elements *model.ElectricalConnectionDescriptionDataElementsType,
) (*model.MsgCounterType, error) {
return e.requestData(model.FunctionTypeElectricalConnectionDescriptionListData, selector, elements)
}
// request FunctionTypeElectricalConnectionParameterDescriptionListData from a remote entity
func (e *ElectricalConnection) RequestParameterDescriptions(
selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType,
elements *model.ElectricalConnectionParameterDescriptionDataElementsType,
) (*model.MsgCounterType, error) {
return e.requestData(model.FunctionTypeElectricalConnectionParameterDescriptionListData, selector, elements)
}
// request FunctionTypeElectricalConnectionPermittedValueSetListData from a remote entity
func (e *ElectricalConnection) RequestPermittedValueSets(
selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType,
elements *model.ElectricalConnectionPermittedValueSetDataElementsType,
) (*model.MsgCounterType, error) {
return e.requestData(model.FunctionTypeElectricalConnectionPermittedValueSetListData, selector, elements)
}
// request FunctionTypeElectricalConnectionCharacteristicListData from a remote entity
func (e *ElectricalConnection) RequestCharacteristics(
selector *model.ElectricalConnectionCharacteristicListDataSelectorsType,
elements *model.ElectricalConnectionCharacteristicDataElementsType,
) (*model.MsgCounterType, error) {
return e.requestData(model.FunctionTypeElectricalConnectionCharacteristicListData, selector, elements)
}
@@ -0,0 +1,177 @@
package client
import (
"errors"
"fmt"
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type Feature struct {
featureType model.FeatureTypeType
localRole model.RoleType
remoteRole model.RoleType
spineLocalDevice spineapi.DeviceLocalInterface
localEntity spineapi.EntityLocalInterface
featureLocal spineapi.FeatureLocalInterface
featureRemote spineapi.FeatureRemoteInterface
remoteDevice spineapi.DeviceRemoteInterface
remoteEntity spineapi.EntityRemoteInterface
}
var _ api.FeatureClientInterface = (*Feature)(nil)
func NewFeature(
featureType model.FeatureTypeType,
localEntity spineapi.EntityLocalInterface,
remoteEntity spineapi.EntityRemoteInterface) (*Feature, error) {
if localEntity == nil {
return nil, errors.New("local entity is nil")
}
if remoteEntity == nil {
return nil, errors.New("remote entity is nil")
}
f := &Feature{
featureType: featureType,
localRole: model.RoleTypeClient,
remoteRole: model.RoleTypeServer,
spineLocalDevice: localEntity.Device(),
localEntity: localEntity,
remoteDevice: remoteEntity.Device(),
remoteEntity: remoteEntity,
}
var err error
f.featureLocal, f.featureRemote, err = f.getLocalAndRemoteFeatures()
return f, err
}
// check if there is a subscription to the remote feature
func (f *Feature) HasSubscription() bool {
subscription := f.featureLocal.HasSubscriptionToRemote(f.featureRemote.Address())
return subscription
}
// subscribe to the feature of the entity
func (f *Feature) Subscribe() (*model.MsgCounterType, error) {
msgCounter, fErr := f.featureLocal.SubscribeToRemote(f.featureRemote.Address())
if fErr != nil {
return nil, errors.New(fErr.String())
}
return msgCounter, nil
}
// unssubscribe to the feature of the entity
func (f *Feature) Unsubscribe() (*model.MsgCounterType, error) {
msgCounter, fErr := f.featureLocal.RemoveRemoteSubscription(f.featureRemote.Address())
if fErr != nil {
return nil, errors.New(fErr.String())
}
return msgCounter, nil
}
// check if there is a binding to the remote feature
func (f *Feature) HasBinding() bool {
binding := f.featureLocal.HasBindingToRemote(f.featureRemote.Address())
return binding
}
// bind to the feature of the entity
func (f *Feature) Bind() (*model.MsgCounterType, error) {
msgCounter, fErr := f.featureLocal.BindToRemote(f.featureRemote.Address())
if fErr != nil {
return nil, errors.New(fErr.String())
}
return msgCounter, nil
}
// remove a binding to the feature of the entity
func (f *Feature) Unbind() (*model.MsgCounterType, error) {
msgCounter, fErr := f.featureLocal.RemoveRemoteBinding(f.featureRemote.Address())
if fErr != nil {
return nil, errors.New(fErr.String())
}
return msgCounter, nil
}
// add a callback function to be invoked once a result or reply message for a msgCounter came in
func (f *Feature) AddResponseCallback(
msgCounterReference model.MsgCounterType,
function func(msg spineapi.ResponseMessage)) error {
return f.featureLocal.AddResponseCallback(msgCounterReference, function)
}
// add a callback function to be invoked once a result came in
func (f *Feature) AddResultCallback(function func(msg spineapi.ResponseMessage)) {
f.featureLocal.AddResultCallback(function)
}
// helper method which adds checking if the feature is available and the operation is allowed
// selectors and elements are used if specific data should be requested by using
// model.FilterType DataSelectors (selectors) and/or DataElements (elements)
// both should use the proper data types for the used function
//
// Note: selectors and elements have to be pointers!
func (f *Feature) requestData(function model.FunctionType, selectors any, elements any) (*model.MsgCounterType, error) {
if f.featureRemote == nil {
return nil, api.ErrDataNotAvailable
}
fTypes := f.featureRemote.Operations()
op, exists := fTypes[function]
if !exists || !op.Read() {
errWithFunction := fmt.Sprintf("%s %s", api.ErrOperationOnFunctionNotSupported.Error(), function)
return nil, errors.New(errWithFunction)
}
// remove the selectors if the remote does not allow partial reads
// or partial writes, because in that case we need to have all data
if selectors != nil && (!op.ReadPartial() || !op.WritePartial()) {
selectors = nil
elements = nil
}
msgCounter, fErr := f.featureLocal.RequestRemoteData(function, selectors, elements, f.featureRemote)
if fErr != nil {
return nil, errors.New(fErr.String())
}
return msgCounter, nil
}
// internal helper method for getting local and remote feature for a given featureType and a given remoteDevice
func (f *Feature) getLocalAndRemoteFeatures() (
spineapi.FeatureLocalInterface,
spineapi.FeatureRemoteInterface,
error) {
featureLocal := f.localEntity.FeatureOfTypeAndRole(f.featureType, f.localRole)
if featureLocal == nil {
featureLocal = f.localEntity.FeatureOfTypeAndRole(model.FeatureTypeTypeGeneric, f.localRole)
}
if featureLocal == nil {
return nil, nil, errors.New("local feature not found")
}
featureRemote := f.remoteEntity.Device().FeatureByEntityTypeAndRole(f.remoteEntity, f.featureType, f.remoteRole)
if featureRemote == nil {
return nil, nil, errors.New("remote feature not found")
}
return featureLocal, featureRemote, nil
}
@@ -0,0 +1,38 @@
package client
import (
internal "github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type Identification struct {
*Feature
*internal.IdentificationCommon
}
// Get a new Identification features helper
//
// - The feature on the local entity has to be of role client
// - The feature on the remote entity has to be of role server
func NewIdentification(
localEntity spineapi.EntityLocalInterface,
remoteEntity spineapi.EntityRemoteInterface) (*Identification, error) {
feature, err := NewFeature(model.FeatureTypeTypeIdentification, localEntity, remoteEntity)
if err != nil {
return nil, err
}
i := &Identification{
Feature: feature,
IdentificationCommon: internal.NewRemoteIdentification(feature.featureRemote),
}
return i, nil
}
// request FunctionTypeIdentificationListData from a remote entity
func (i *Identification) RequestValues() (*model.MsgCounterType, error) {
return i.requestData(model.FunctionTypeIdentificationListData, nil, nil)
}
@@ -0,0 +1,83 @@
package client
import (
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type IncentiveTable struct {
*Feature
*internal.IncentiveTableCommon
}
// Get a new IncentiveTable features helper
//
// - The feature on the local entity has to be of role client
// - The feature on the remote entity has to be of role server
func NewIncentiveTable(
localEntity spineapi.EntityLocalInterface,
remoteEntity spineapi.EntityRemoteInterface) (*IncentiveTable, error) {
feature, err := NewFeature(model.FeatureTypeTypeIncentiveTable, localEntity, remoteEntity)
if err != nil {
return nil, err
}
i := &IncentiveTable{
Feature: feature,
IncentiveTableCommon: internal.NewRemoteIncentiveTable(feature.featureRemote),
}
return i, nil
}
var _ api.IncentiveTableClientInterface = (*IncentiveTable)(nil)
// request FunctionTypeIncentiveTableDescriptionData from a remote entity
func (i *IncentiveTable) RequestDescriptions() (*model.MsgCounterType, error) {
return i.requestData(model.FunctionTypeIncentiveTableDescriptionData, nil, nil)
}
// request FunctionTypeIncentiveTableConstraintsData from a remote entity
func (i *IncentiveTable) RequestConstraints() (*model.MsgCounterType, error) {
return i.requestData(model.FunctionTypeIncentiveTableConstraintsData, nil, nil)
}
// request FunctionTypeIncentiveTableData from a remote entity
func (i *IncentiveTable) RequestValues() (*model.MsgCounterType, error) {
return i.requestData(model.FunctionTypeIncentiveTableData, nil, nil)
}
// write incentivetable descriptions
// returns an error if this failed
func (i *IncentiveTable) WriteDescriptions(data []model.IncentiveTableDescriptionType) (*model.MsgCounterType, error) {
if len(data) == 0 {
return nil, api.ErrMissingData
}
cmd := model.CmdType{
IncentiveTableDescriptionData: &model.IncentiveTableDescriptionDataType{
IncentiveTableDescription: data,
},
}
return i.remoteDevice.Sender().Write(i.featureLocal.Address(), i.featureRemote.Address(), cmd)
}
// write incentivetable descriptions
// returns an error if this failed
func (i *IncentiveTable) WriteValues(data []model.IncentiveTableType) (*model.MsgCounterType, error) {
if len(data) == 0 {
return nil, api.ErrMissingData
}
cmd := model.CmdType{
IncentiveTableData: &model.IncentiveTableDataType{
IncentiveTable: data,
},
}
return i.remoteDevice.Sender().Write(i.featureLocal.Address(), i.featureRemote.Address(), cmd)
}
@@ -0,0 +1,115 @@
package client
import (
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
"github.com/enbility/spine-go/util"
)
type LoadControl struct {
*Feature
*internal.LoadControlCommon
}
// Get a new LoadControl features helper
//
// - The feature on the local entity has to be of role client
// - The feature on the remote entity has to be of role server
func NewLoadControl(
localEntity spineapi.EntityLocalInterface,
remoteEntity spineapi.EntityRemoteInterface) (*LoadControl, error) {
feature, err := NewFeature(model.FeatureTypeTypeLoadControl, localEntity, remoteEntity)
if err != nil {
return nil, err
}
lc := &LoadControl{
Feature: feature,
LoadControlCommon: internal.NewRemoteLoadControl(feature.featureRemote),
}
return lc, nil
}
var _ api.LoadControlClientInterface = (*LoadControl)(nil)
// request FunctionTypeLoadControlLimitDescriptionListData from a remote device
func (l *LoadControl) RequestLimitDescriptions(
selector *model.LoadControlLimitDescriptionListDataSelectorsType,
elements *model.LoadControlLimitDescriptionDataElementsType,
) (*model.MsgCounterType, error) {
return l.requestData(model.FunctionTypeLoadControlLimitDescriptionListData, selector, elements)
}
// request FunctionTypeLoadControlLimitConstraintsListData from a remote device
func (l *LoadControl) RequestLimitConstraints(
selector *model.LoadControlLimitConstraintsListDataSelectorsType,
elements *model.LoadControlLimitConstraintsDataElementsType,
) (*model.MsgCounterType, error) {
return l.requestData(model.FunctionTypeLoadControlLimitConstraintsListData, selector, elements)
}
// request FunctionTypeLoadControlLimitListData from a remote device
func (l *LoadControl) RequestLimitData(
selector *model.LoadControlLimitListDataSelectorsType,
elements *model.LoadControlLimitDataElementsType,
) (*model.MsgCounterType, error) {
return l.requestData(model.FunctionTypeLoadControlLimitListData, selector, elements)
}
// write load control limits
// returns an error if this failed
func (l *LoadControl) WriteLimitData(
data []model.LoadControlLimitDataType,
deleteSelectors *model.LoadControlLimitListDataSelectorsType,
deleteElements *model.LoadControlLimitDataElementsType,
) (*model.MsgCounterType, error) {
if len(data) == 0 {
return nil, api.ErrMissingData
}
var filters []model.FilterType
var delFilter *model.FilterType
partialFilter := model.NewFilterTypePartial()
if deleteElements != nil && deleteSelectors != nil {
delFilter = &model.FilterType{
CmdControl: &model.CmdControlType{
Delete: &model.ElementTagType{},
},
LoadControlLimitListDataSelectors: deleteSelectors,
LoadControlLimitDataElements: deleteElements,
}
filters = append(filters, *delFilter)
}
filters = append(filters, *partialFilter)
// does the remote server feature not support partials?
operation := l.featureRemote.Operations()[model.FunctionTypeLoadControlLimitListData]
if operation == nil || !operation.WritePartial() {
filters = nil
// we need to send all data
updateData := &model.LoadControlLimitListDataType{
LoadControlLimitData: data,
}
if mergedData, err := l.featureRemote.UpdateData(false, model.FunctionTypeLoadControlLimitListData, updateData, partialFilter, delFilter); err == nil {
data = mergedData.([]model.LoadControlLimitDataType)
}
}
cmd := model.CmdType{
LoadControlLimitListData: &model.LoadControlLimitListDataType{
LoadControlLimitData: data,
},
}
if filters != nil {
cmd.Filter = filters
cmd.Function = util.Ptr(model.FunctionTypeLoadControlLimitListData)
}
return l.remoteDevice.Sender().Write(l.featureLocal.Address(), l.featureRemote.Address(), cmd)
}
@@ -0,0 +1,60 @@
package client
import (
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type Measurement struct {
*Feature
*internal.MeasurementCommon
}
var _ api.MeasurementClientInterface = (*Measurement)(nil)
// Get a new Measurement features helper
//
// - The feature on the local entity has to be of role client
// - The feature on the remote entity has to be of role server
func NewMeasurement(
localEntity spineapi.EntityLocalInterface,
remoteEntity spineapi.EntityRemoteInterface) (*Measurement, error) {
feature, err := NewFeature(model.FeatureTypeTypeMeasurement, localEntity, remoteEntity)
if err != nil {
return nil, err
}
m := &Measurement{
Feature: feature,
MeasurementCommon: internal.NewRemoteMeasurement(feature.featureRemote),
}
return m, nil
}
// request FunctionTypeMeasurementDescriptionListData from a remote device
func (m *Measurement) RequestDescriptions(
selector *model.MeasurementDescriptionListDataSelectorsType,
elements *model.MeasurementDescriptionDataElementsType,
) (*model.MsgCounterType, error) {
return m.requestData(model.FunctionTypeMeasurementDescriptionListData, selector, elements)
}
// request FunctionTypeMeasurementConstraintsListData from a remote entity
func (m *Measurement) RequestConstraints(
selector *model.MeasurementConstraintsListDataSelectorsType,
elements *model.MeasurementConstraintsDataElementsType,
) (*model.MsgCounterType, error) {
return m.requestData(model.FunctionTypeMeasurementConstraintsListData, selector, elements)
}
// request FunctionTypeMeasurementListData from a remote entity
func (m *Measurement) RequestData(
selector *model.MeasurementListDataSelectorsType,
elements *model.MeasurementDataElementsType,
) (*model.MsgCounterType, error) {
return m.requestData(model.FunctionTypeMeasurementListData, selector, elements)
}
@@ -0,0 +1,56 @@
package client
import (
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
"github.com/enbility/spine-go/util"
)
type SmartEnergyManagementPs struct {
*Feature
*internal.SmartEnergyManagementPsCommon
}
// Get a new Identification features helper
//
// - The feature on the local entity has to be of role client
// - The feature on the remote entity has to be of role server
func NewSmartEnergyManagementPs(
localEntity spineapi.EntityLocalInterface,
remoteEntity spineapi.EntityRemoteInterface) (*SmartEnergyManagementPs, error) {
feature, err := NewFeature(model.FeatureTypeTypeSmartEnergyManagementPs, localEntity, remoteEntity)
if err != nil {
return nil, err
}
i := &SmartEnergyManagementPs{
Feature: feature,
SmartEnergyManagementPsCommon: internal.NewRemoteSmartEnergyManagementPs(feature.featureRemote),
}
return i, nil
}
// request FunctionTypeSmartEnergyManagementPsData from a remote entity
func (i *SmartEnergyManagementPs) RequestData() (*model.MsgCounterType, error) {
return i.requestData(model.FunctionTypeSmartEnergyManagementPsData, nil, nil)
}
// write SmartEnergyManagementPsData
// returns an error if this failed
func (l *SmartEnergyManagementPs) WriteData(data *model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error) {
if data == nil {
return nil, api.ErrMissingData
}
cmd := model.CmdType{
Function: util.Ptr(model.FunctionTypeSmartEnergyManagementPsData),
Filter: []model.FilterType{*model.NewFilterTypePartial()},
SmartEnergyManagementPsData: data,
}
return l.remoteDevice.Sender().Write(l.featureLocal.Address(), l.featureRemote.Address(), cmd)
}
@@ -0,0 +1,76 @@
package client
import (
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type TimeSeries struct {
*Feature
*internal.TimeSeriesCommon
}
// Get a new TimeSeries features helper
//
// - The feature on the local entity has to be of role client
// - The feature on the remote entity has to be of role server
func NewTimeSeries(
localEntity spineapi.EntityLocalInterface,
remoteEntity spineapi.EntityRemoteInterface) (*TimeSeries, error) {
feature, err := NewFeature(model.FeatureTypeTypeTimeSeries, localEntity, remoteEntity)
if err != nil {
return nil, err
}
t := &TimeSeries{
Feature: feature,
TimeSeriesCommon: internal.NewRemoteTimeSeries(feature.featureRemote),
}
return t, nil
}
var _ api.TimeSeriesClientInterface = (*TimeSeries)(nil)
// request FunctionTypeTimeSeriesDescriptionListData from a remote entity
func (t *TimeSeries) RequestDescriptions(
selector *model.TimeSeriesDescriptionListDataSelectorsType,
elements *model.TimeSeriesDescriptionDataElementsType,
) (*model.MsgCounterType, error) {
return t.requestData(model.FunctionTypeTimeSeriesDescriptionListData, selector, elements)
}
// request FunctionTypeTimeSeriesConstraintsListData from a remote entity
func (t *TimeSeries) RequestConstraints(
selector *model.TimeSeriesConstraintsListDataSelectorsType,
elements *model.TimeSeriesConstraintsDataElementsType,
) (*model.MsgCounterType, error) {
return t.requestData(model.FunctionTypeTimeSeriesConstraintsListData, selector, elements)
}
// request FunctionTypeTimeSeriesListData from a remote device
func (t *TimeSeries) RequestData(
selector *model.TimeSeriesListDataSelectorsType,
elements *model.TimeSeriesDataElementsType,
) (*model.MsgCounterType, error) {
return t.requestData(model.FunctionTypeTimeSeriesListData, selector, elements)
}
// write Time Series values
// returns an error if this failed
func (t *TimeSeries) WriteData(data []model.TimeSeriesDataType) (*model.MsgCounterType, error) {
if len(data) == 0 {
return nil, api.ErrMissingData
}
cmd := model.CmdType{
TimeSeriesListData: &model.TimeSeriesListDataType{
TimeSeriesData: data,
},
}
return t.remoteDevice.Sender().Write(t.featureLocal.Address(), t.featureRemote.Address(), cmd)
}
@@ -0,0 +1,37 @@
package internal
import (
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type DeviceClassificationCommon struct {
featureLocal spineapi.FeatureLocalInterface
featureRemote spineapi.FeatureRemoteInterface
}
func NewLocalDeviceClassification(featureLocal spineapi.FeatureLocalInterface) *DeviceClassificationCommon {
return &DeviceClassificationCommon{
featureLocal: featureLocal,
}
}
func NewRemoteDeviceClassification(featureRemote spineapi.FeatureRemoteInterface) *DeviceClassificationCommon {
return &DeviceClassificationCommon{
featureRemote: featureRemote,
}
}
var _ api.DeviceClassificationCommonInterface = (*DeviceClassificationCommon)(nil)
// get the current manufacturer details for a remote device entity
func (d *DeviceClassificationCommon) GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error) {
function := model.FunctionTypeDeviceClassificationManufacturerData
data, err := featureDataCopyOfType[model.DeviceClassificationManufacturerDataType](d.featureLocal, d.featureRemote, function)
if err != nil || data == nil {
return nil, api.ErrDataNotAvailable
}
return data, nil
}
@@ -0,0 +1,130 @@
package internal
import (
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type DeviceConfigurationCommon struct {
featureLocal spineapi.FeatureLocalInterface
featureRemote spineapi.FeatureRemoteInterface
}
func NewLocalDeviceConfiguration(featureLocal spineapi.FeatureLocalInterface) *DeviceConfigurationCommon {
return &DeviceConfigurationCommon{
featureLocal: featureLocal,
}
}
func NewRemoteDeviceConfiguration(featureRemote spineapi.FeatureRemoteInterface) *DeviceConfigurationCommon {
return &DeviceConfigurationCommon{
featureRemote: featureRemote,
}
}
var _ api.DeviceConfigurationCommonInterface = (*DeviceConfigurationCommon)(nil)
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.DeviceConfigurationKeyValueListDataType,
// filter type will be checked for model.DeviceConfigurationKeyValueDescriptionDataType
func (d *DeviceConfigurationCommon) CheckEventPayloadDataForFilter(payloadData any, filter any) bool {
if payloadData == nil {
return false
}
data, ok := payloadData.(*model.DeviceConfigurationKeyValueListDataType)
filterData, ok2 := filter.(model.DeviceConfigurationKeyValueDescriptionDataType)
if !ok || !ok2 {
return false
}
descs, err := d.GetKeyValueDescriptionsForFilter(filterData)
if err != nil {
return false
}
for _, desc := range descs {
if desc.KeyId == nil {
continue
}
for _, item := range data.DeviceConfigurationKeyValueData {
if item.KeyId != nil &&
*item.KeyId == *desc.KeyId ||
item.Value != nil {
return true
}
}
}
return false
}
// Get the description for a given keyId
//
// Will return nil if no matching description is found
func (d *DeviceConfigurationCommon) GetKeyValueDescriptionFoKeyId(keyId model.DeviceConfigurationKeyIdType) (
*model.DeviceConfigurationKeyValueDescriptionDataType, error) {
data, err := d.GetKeyValueDescriptionsForFilter(model.DeviceConfigurationKeyValueDescriptionDataType{KeyId: &keyId})
if err != nil || len(data) != 1 {
return nil, api.ErrDataNotAvailable
}
return &data[0], nil
}
// Get the description for a given value combination
//
// Returns an error if no matching description is found
func (d *DeviceConfigurationCommon) GetKeyValueDescriptionsForFilter(
filter model.DeviceConfigurationKeyValueDescriptionDataType,
) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error) {
function := model.FunctionTypeDeviceConfigurationKeyValueDescriptionListData
data, err := featureDataCopyOfType[model.DeviceConfigurationKeyValueDescriptionListDataType](d.featureLocal, d.featureRemote, function)
if err != nil || data == nil || data.DeviceConfigurationKeyValueDescriptionData == nil {
return nil, api.ErrDataNotAvailable
}
result := searchFilterInList[model.DeviceConfigurationKeyValueDescriptionDataType](
data.DeviceConfigurationKeyValueDescriptionData, filter)
return result, nil
}
// Get the key value data for a given keyId
//
// Will return nil if no data is available
func (d *DeviceConfigurationCommon) GetKeyValueDataForKeyId(keyId model.DeviceConfigurationKeyIdType) (
*model.DeviceConfigurationKeyValueDataType, error) {
return d.GetKeyValueDataForFilter(model.DeviceConfigurationKeyValueDescriptionDataType{KeyId: &keyId})
}
// Get key value data for a given filter
//
// Will return nil if no data is available
func (d *DeviceConfigurationCommon) GetKeyValueDataForFilter(filter model.DeviceConfigurationKeyValueDescriptionDataType) (
*model.DeviceConfigurationKeyValueDataType, error) {
function := model.FunctionTypeDeviceConfigurationKeyValueListData
descriptions, err := d.GetKeyValueDescriptionsForFilter(filter)
if err != nil || descriptions == nil || len(descriptions) == 0 {
return nil, api.ErrDataNotAvailable
}
description := descriptions[0]
data, err := featureDataCopyOfType[model.DeviceConfigurationKeyValueListDataType](d.featureLocal, d.featureRemote, function)
if err != nil || data == nil || data.DeviceConfigurationKeyValueData == nil {
return nil, api.ErrDataNotAvailable
}
for _, item := range data.DeviceConfigurationKeyValueData {
if item.KeyId != nil && *item.KeyId == *description.KeyId {
return &item, nil
}
}
return nil, api.ErrDataNotAvailable
}
@@ -0,0 +1,59 @@
package internal
import (
"time"
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type DeviceDiagnosisCommon struct {
featureLocal spineapi.FeatureLocalInterface
featureRemote spineapi.FeatureRemoteInterface
}
func NewLocalDeviceDiagnosis(featureLocal spineapi.FeatureLocalInterface) *DeviceDiagnosisCommon {
return &DeviceDiagnosisCommon{
featureLocal: featureLocal,
}
}
func NewRemoteDeviceDiagnosis(featureRemote spineapi.FeatureRemoteInterface) *DeviceDiagnosisCommon {
return &DeviceDiagnosisCommon{
featureRemote: featureRemote,
}
}
var _ api.DeviceDiagnosisCommonInterface = (*DeviceDiagnosisCommon)(nil)
// get the current diagnosis state for an device entity
func (d *DeviceDiagnosisCommon) GetState() (*model.DeviceDiagnosisStateDataType, error) {
function := model.FunctionTypeDeviceDiagnosisStateData
data, err := featureDataCopyOfType[model.DeviceDiagnosisStateDataType](d.featureLocal, d.featureRemote, function)
if err != nil {
return nil, api.ErrDataNotAvailable
}
return data, nil
}
// check if the currently available heartbeat data is within a time duration
func (d *DeviceDiagnosisCommon) IsHeartbeatWithinDuration(duration time.Duration) bool {
function := model.FunctionTypeDeviceDiagnosisHeartbeatData
data, err := featureDataCopyOfType[model.DeviceDiagnosisHeartbeatDataType](d.featureLocal, d.featureRemote, function)
if err != nil || data == nil || data.Timestamp == nil {
return false
}
timeValue, err := data.Timestamp.GetTime()
if err != nil {
return false
}
diff := time.Now().UTC().Add(-1 * duration)
return diff.Compare(timeValue.Local()) <= 0
}
@@ -0,0 +1,293 @@
package internal
import (
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
"github.com/enbility/spine-go/util"
)
type ElectricalConnectionCommon struct {
featureLocal spineapi.FeatureLocalInterface
featureRemote spineapi.FeatureRemoteInterface
}
func NewLocalElectricalConnection(featureLocal spineapi.FeatureLocalInterface) *ElectricalConnectionCommon {
return &ElectricalConnectionCommon{
featureLocal: featureLocal,
}
}
func NewRemoteElectricalConnection(featureRemote spineapi.FeatureRemoteInterface) *ElectricalConnectionCommon {
return &ElectricalConnectionCommon{
featureRemote: featureRemote,
}
}
var _ api.ElectricalConnectionCommonInterface = (*ElectricalConnectionCommon)(nil)
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.ElectricalConnectionPermittedValueSetListDataType,
// filter type will be checked for model.ElectricalConnectionParameterDescriptionDataType
func (e *ElectricalConnectionCommon) CheckEventPayloadDataForFilter(payloadData any, filter any) bool {
if payloadData == nil {
return false
}
data, ok := payloadData.(*model.ElectricalConnectionPermittedValueSetListDataType)
filterData, ok2 := filter.(model.ElectricalConnectionParameterDescriptionDataType)
if !ok || !ok2 {
return false
}
descs, err := e.GetParameterDescriptionsForFilter(filterData)
if err != nil {
return false
}
for _, desc := range descs {
for _, item := range data.ElectricalConnectionPermittedValueSetData {
if item.ParameterId != nil &&
desc.ParameterId != nil &&
*item.ParameterId == *desc.ParameterId &&
len(item.PermittedValueSet) != 0 {
return true
}
}
}
return false
}
// Get the description for a given filter
//
// Returns an error if no matching description is found
func (e *ElectricalConnectionCommon) GetDescriptionsForFilter(
filter model.ElectricalConnectionDescriptionDataType,
) ([]model.ElectricalConnectionDescriptionDataType, error) {
function := model.FunctionTypeElectricalConnectionDescriptionListData
data, err := featureDataCopyOfType[model.ElectricalConnectionDescriptionListDataType](e.featureLocal, e.featureRemote, function)
if err != nil || data == nil || data.ElectricalConnectionDescriptionData == nil {
return nil, api.ErrDataNotAvailable
}
result := searchFilterInList[model.ElectricalConnectionDescriptionDataType](
data.ElectricalConnectionDescriptionData, filter)
return result, nil
}
// return current electrical description for a given parameter description
func (e *ElectricalConnectionCommon) GetDescriptionForParameterDescriptionFilter(
filter model.ElectricalConnectionParameterDescriptionDataType) (
*model.ElectricalConnectionDescriptionDataType, error) {
param, err := e.GetParameterDescriptionsForFilter(filter)
if err != nil || len(param) == 0 {
return nil, err
}
descriptions, err := e.GetDescriptionsForFilter(model.ElectricalConnectionDescriptionDataType{})
if err != nil {
return nil, err
}
for _, item := range descriptions {
if item.ElectricalConnectionId == nil ||
param[0].ElectricalConnectionId == nil ||
*item.ElectricalConnectionId != *param[0].ElectricalConnectionId {
continue
}
return &item, nil
}
return nil, api.ErrMetadataNotAvailable
}
// Get the description for a given filter
//
// Returns an error if no matching description is found
func (e *ElectricalConnectionCommon) GetParameterDescriptionsForFilter(
filter model.ElectricalConnectionParameterDescriptionDataType,
) ([]model.ElectricalConnectionParameterDescriptionDataType, error) {
function := model.FunctionTypeElectricalConnectionParameterDescriptionListData
data, err := featureDataCopyOfType[model.ElectricalConnectionParameterDescriptionListDataType](e.featureLocal, e.featureRemote, function)
if err != nil || data == nil || data.ElectricalConnectionParameterDescriptionData == nil {
return nil, api.ErrDataNotAvailable
}
result := searchFilterInList[model.ElectricalConnectionParameterDescriptionDataType](
data.ElectricalConnectionParameterDescriptionData, filter)
return result, nil
}
// return permitted values for all Electrical Connections
func (e *ElectricalConnectionCommon) GetPermittedValueSetForFilter(
filter model.ElectricalConnectionPermittedValueSetDataType) (
[]model.ElectricalConnectionPermittedValueSetDataType, error) {
function := model.FunctionTypeElectricalConnectionPermittedValueSetListData
data, err := featureDataCopyOfType[model.ElectricalConnectionPermittedValueSetListDataType](e.featureLocal, e.featureRemote, function)
if err != nil || data == nil || data.ElectricalConnectionPermittedValueSetData == nil {
return nil, api.ErrDataNotAvailable
}
result := searchFilterInList[model.ElectricalConnectionPermittedValueSetDataType](data.ElectricalConnectionPermittedValueSetData, filter)
return result, nil
}
// returns minimum, maximum, default/pause limit values
func (e *ElectricalConnectionCommon) GetPermittedValueDataForFilter(
filter model.ElectricalConnectionPermittedValueSetDataType) (
float64, float64, float64, error) {
data, err := e.GetPermittedValueSetForFilter(filter)
if err != nil || len(data) != 1 ||
data[0].ElectricalConnectionId == nil ||
data[0].PermittedValueSet == nil {
return 0, 0, 0, api.ErrDataNotAvailable
}
var resultMin, resultMax, resultDefault float64
for _, set := range data[0].PermittedValueSet {
if len(set.Value) > 0 {
resultDefault = set.Value[0].GetValue()
}
if set.Range != nil {
for _, rangeItem := range set.Range {
if rangeItem.Min != nil {
resultMin = rangeItem.Min.GetValue()
}
if rangeItem.Max != nil {
resultMax = rangeItem.Max.GetValue()
}
}
}
}
return resultMin, resultMax, resultDefault, nil
}
var PhaseNameMapping = []model.ElectricalConnectionPhaseNameType{
model.ElectricalConnectionPhaseNameTypeA,
model.ElectricalConnectionPhaseNameTypeB,
model.ElectricalConnectionPhaseNameTypeC}
// Get the min, max, default current limits for each phase
func (e *ElectricalConnectionCommon) GetPhaseCurrentLimits(measurementDescs []model.MeasurementDescriptionDataType) (
resultMin []float64, resultMax []float64, resultDefault []float64, resultErr error) {
for _, phaseName := range PhaseNameMapping {
// electricalParameterDescription contains the measured phase for each measurementId
filter := model.ElectricalConnectionParameterDescriptionDataType{
AcMeasuredPhases: util.Ptr(phaseName),
}
elParamDesc, err := e.GetParameterDescriptionsForFilter(filter)
if err != nil || len(elParamDesc) == 0 {
continue
}
// check all params and assume there are no phase specific power limits
for _, paramEl := range elParamDesc {
if paramEl.ParameterId == nil || paramEl.MeasurementId == nil {
continue
}
// check if the measurementId is in measurementDescs
found := false
for _, mDesc := range measurementDescs {
if mDesc.MeasurementId != nil && *mDesc.MeasurementId == *paramEl.MeasurementId {
found = true
break
}
}
if !found {
continue
}
filter1 := model.ElectricalConnectionPermittedValueSetDataType{
ParameterId: paramEl.ParameterId,
}
dataMin, dataMax, dataDefault, err := e.GetPermittedValueDataForFilter(filter1)
if err != nil {
continue
}
// Min current data should be derived from min power data
// but as this value is only properly provided via VAS the
// currrent min values can not be trusted.
resultMin = append(resultMin, dataMin)
resultMax = append(resultMax, dataMax)
resultDefault = append(resultDefault, dataDefault)
}
}
if len(resultMin) == 0 {
return nil, nil, nil, api.ErrDataNotAvailable
}
return resultMin, resultMax, resultDefault, nil
}
// Adjust a value to be within the permitted value range
func (e *ElectricalConnectionCommon) AdjustValueToBeWithinPermittedValuesForParameterId(
value float64, parameterId model.ElectricalConnectionParameterIdType) float64 {
filter := model.ElectricalConnectionPermittedValueSetDataType{
ParameterId: &parameterId,
}
data, err := e.GetPermittedValueSetForFilter(filter)
if err != nil || len(data) != 1 {
return value
}
var defaultValue, minValue, maxValue float64
var hasDefaultValue, hasRange bool
for _, element := range data[0].PermittedValueSet {
// is a value set
if len(element.Value) > 0 {
defaultValue = element.Value[0].GetValue()
hasDefaultValue = true
}
// is a range set
if len(element.Range) > 0 {
if element.Range[0].Min != nil {
minValue = element.Range[0].Min.GetValue()
}
if element.Range[0].Max != nil {
maxValue = element.Range[0].Max.GetValue()
}
hasRange = true
}
}
if hasRange {
if hasDefaultValue && value < minValue {
value = defaultValue
}
if value > maxValue {
value = maxValue
}
}
return value
}
// Get the characteristics for a given filter
//
// Returns an error if no matching description is found
func (e *ElectricalConnectionCommon) GetCharacteristicsForFilter(
filter model.ElectricalConnectionCharacteristicDataType,
) ([]model.ElectricalConnectionCharacteristicDataType, error) {
function := model.FunctionTypeElectricalConnectionCharacteristicListData
data, err := featureDataCopyOfType[model.ElectricalConnectionCharacteristicListDataType](e.featureLocal, e.featureRemote, function)
if err != nil || data == nil || data.ElectricalConnectionCharacteristicData == nil {
return nil, api.ErrDataNotAvailable
}
result := searchFilterInList[model.ElectricalConnectionCharacteristicDataType](data.ElectricalConnectionCharacteristicData, filter)
return result, nil
}
@@ -0,0 +1,61 @@
package internal
import (
"reflect"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
"github.com/enbility/spine-go/spine"
)
func featureDataCopyOfType[T any](
featureLocal spineapi.FeatureLocalInterface,
featureRemote spineapi.FeatureRemoteInterface,
function model.FunctionType) (*T, error) {
var data *T
var err error
if featureLocal != nil {
data, err = spine.LocalFeatureDataCopyOfType[*T](featureLocal, function)
} else {
data, err = spine.RemoteFeatureDataCopyOfType[*T](featureRemote, function)
}
return data, err
}
func searchFilterInItem[T any](item T, filter T) bool {
v := reflect.ValueOf(item)
match := true
for i := 0; i < v.NumField(); i++ {
filterField := reflect.ValueOf(filter).Field(i)
itemField := v.Field(i)
if filterField.Kind() != reflect.Ptr || itemField.Kind() != reflect.Ptr {
continue
}
if (!filterField.IsNil() && !itemField.IsNil() && filterField.Elem().Interface() != itemField.Elem().Interface()) ||
(!filterField.IsNil() && itemField.IsNil()) {
match = false
break
}
}
return match
}
func searchFilterInList[T any](list []T, filter T) []T {
var result []T
for _, item := range list {
match := searchFilterInItem[T](item, filter)
if match {
result = append(result, item)
}
}
return result
}
@@ -0,0 +1,63 @@
package internal
import (
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type IdentificationCommon struct {
featureLocal spineapi.FeatureLocalInterface
featureRemote spineapi.FeatureRemoteInterface
}
func NewLocalIdentification(featureLocal spineapi.FeatureLocalInterface) *IdentificationCommon {
return &IdentificationCommon{
featureLocal: featureLocal,
}
}
func NewRemoteIdentification(featureRemote spineapi.FeatureRemoteInterface) *IdentificationCommon {
return &IdentificationCommon{
featureRemote: featureRemote,
}
}
var _ api.IdentificationCommonInterface = (*IdentificationCommon)(nil)
// check if spine.EventPayload Data contains identification data
//
// data type will be checked for model.IdentificationListDataType
func (i *IdentificationCommon) CheckEventPayloadDataForFilter(payloadData any) bool {
if payloadData == nil {
return false
}
data, ok := payloadData.(*model.IdentificationListDataType)
if !ok {
return false
}
for _, item := range data.IdentificationData {
if item.IdentificationId == nil || item.IdentificationValue == nil {
continue
}
return true
}
return false
}
// return current values for Identification
func (i *IdentificationCommon) GetDataForFilter(filter model.IdentificationDataType) ([]model.IdentificationDataType, error) {
function := model.FunctionTypeIdentificationListData
data, err := featureDataCopyOfType[model.IdentificationListDataType](i.featureLocal, i.featureRemote, function)
if err != nil || data == nil || data.IdentificationData == nil {
return nil, api.ErrDataNotAvailable
}
result := searchFilterInList[model.IdentificationDataType](data.IdentificationData, filter)
return result, nil
}
@@ -0,0 +1,71 @@
package internal
import (
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type IncentiveTableCommon struct {
featureLocal spineapi.FeatureLocalInterface
featureRemote spineapi.FeatureRemoteInterface
}
func NewLocalIncentiveTable(featureLocal spineapi.FeatureLocalInterface) *IncentiveTableCommon {
return &IncentiveTableCommon{
featureLocal: featureLocal,
}
}
func NewRemoteIncentiveTable(featureRemote spineapi.FeatureRemoteInterface) *IncentiveTableCommon {
return &IncentiveTableCommon{
featureRemote: featureRemote,
}
}
var _ api.IncentiveTableCommonInterface = (*IncentiveTableCommon)(nil)
// return list of descriptions for a given filter
func (i *IncentiveTableCommon) GetDescriptionsForFilter(
filter model.TariffDescriptionDataType,
) ([]model.IncentiveTableDescriptionType, error) {
function := model.FunctionTypeIncentiveTableDescriptionData
data, err := featureDataCopyOfType[model.IncentiveTableDescriptionDataType](i.featureLocal, i.featureRemote, function)
if err != nil || data == nil || data.IncentiveTableDescription == nil {
return nil, api.ErrDataNotAvailable
}
var result []model.IncentiveTableDescriptionType
for _, item := range data.IncentiveTableDescription {
match := searchFilterInItem[model.TariffDescriptionDataType](*item.TariffDescription, filter)
if match {
result = append(result, item)
}
}
return result, nil
}
// return list of constraints
func (i *IncentiveTableCommon) GetConstraints() ([]model.IncentiveTableConstraintsType, error) {
function := model.FunctionTypeIncentiveTableConstraintsData
data, err := featureDataCopyOfType[model.IncentiveTableConstraintsDataType](i.featureLocal, i.featureRemote, function)
if err != nil {
return nil, api.ErrDataNotAvailable
}
return data.IncentiveTableConstraints, nil
}
// return current data for Time Series
func (i *IncentiveTableCommon) GetData() ([]model.IncentiveTableType, error) {
function := model.FunctionTypeIncentiveTableData
data, err := featureDataCopyOfType[model.IncentiveTableDataType](i.featureLocal, i.featureRemote, function)
if err != nil || data == nil || data.IncentiveTable == nil {
return nil, api.ErrDataNotAvailable
}
return data.IncentiveTable, nil
}
@@ -0,0 +1,128 @@
package internal
import (
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type LoadControlCommon struct {
featureLocal spineapi.FeatureLocalInterface
featureRemote spineapi.FeatureRemoteInterface
}
func NewLocalLoadControl(featureLocal spineapi.FeatureLocalInterface) *LoadControlCommon {
return &LoadControlCommon{
featureLocal: featureLocal,
}
}
func NewRemoteLoadControl(featureRemote spineapi.FeatureRemoteInterface) *LoadControlCommon {
return &LoadControlCommon{
featureRemote: featureRemote,
}
}
var _ api.FeatureServerInterface = (*LoadControlCommon)(nil)
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.LoadControlLimitListDataType,
// filter type will be checked for model.LoadControlLimitDescriptionDataType
func (l *LoadControlCommon) CheckEventPayloadDataForFilter(payloadData any, filter any) bool {
if payloadData == nil {
return false
}
data, ok := payloadData.(*model.LoadControlLimitListDataType)
filterData, ok2 := filter.(model.LoadControlLimitDescriptionDataType)
if !ok || !ok2 {
return false
}
descs, _ := l.GetLimitDescriptionsForFilter(filterData)
for _, desc := range descs {
for _, item := range data.LoadControlLimitData {
if item.LimitId != nil &&
desc.LimitId != nil &&
*item.LimitId == *desc.LimitId &&
item.Value != nil {
return true
}
}
}
return false
}
var _ api.LoadControlCommonInterface = (*LoadControlCommon)(nil)
// Get the description for a given limitId
//
// Will return nil if no matching description is found
func (l *LoadControlCommon) GetLimitDescriptionForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error) {
data, err := l.GetLimitDescriptionsForFilter(model.LoadControlLimitDescriptionDataType{LimitId: &limitId})
if err != nil || len(data) != 1 {
return nil, api.ErrDataNotAvailable
}
return &data[0], nil
}
// Get the description for a given filter
//
// Returns an error if no matching description is found
func (l *LoadControlCommon) GetLimitDescriptionsForFilter(
filter model.LoadControlLimitDescriptionDataType,
) ([]model.LoadControlLimitDescriptionDataType, error) {
function := model.FunctionTypeLoadControlLimitDescriptionListData
data, err := featureDataCopyOfType[model.LoadControlLimitDescriptionListDataType](l.featureLocal, l.featureRemote, function)
if err != nil || data == nil || data.LoadControlLimitDescriptionData == nil {
return nil, api.ErrDataNotAvailable
}
result := searchFilterInList[model.LoadControlLimitDescriptionDataType](data.LoadControlLimitDescriptionData, filter)
return result, nil
}
// Get the description for a given limitId
//
// Will return nil if no data is available
func (l *LoadControlCommon) GetLimitDataForId(limitId model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error) {
result, err := l.GetLimitDataForFilter(model.LoadControlLimitDescriptionDataType{LimitId: &limitId})
if err != nil || len(result) == 0 {
return nil, api.ErrDataNotAvailable
}
return &result[0], nil
}
// Get limit data for a given filter
//
// Will return nil if no data is available
func (l *LoadControlCommon) GetLimitDataForFilter(filter model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error) {
function := model.FunctionTypeLoadControlLimitListData
descriptions, err := l.GetLimitDescriptionsForFilter(filter)
if err != nil || len(descriptions) == 0 {
return nil, api.ErrDataNotAvailable
}
data, err := featureDataCopyOfType[model.LoadControlLimitListDataType](l.featureLocal, l.featureRemote, function)
if err != nil || data == nil || data.LoadControlLimitData == nil {
return nil, api.ErrDataNotAvailable
}
var result []model.LoadControlLimitDataType
for _, desc := range descriptions {
filter2 := model.LoadControlLimitDataType{
LimitId: desc.LimitId,
}
elements := searchFilterInList[model.LoadControlLimitDataType](data.LoadControlLimitData, filter2)
result = append(result, elements...)
}
return result, nil
}
@@ -0,0 +1,154 @@
package internal
import (
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type MeasurementCommon struct {
featureLocal spineapi.FeatureLocalInterface
featureRemote spineapi.FeatureRemoteInterface
}
func NewLocalMeasurement(featureLocal spineapi.FeatureLocalInterface) *MeasurementCommon {
return &MeasurementCommon{
featureLocal: featureLocal,
}
}
func NewRemoteMeasurement(featureRemote spineapi.FeatureRemoteInterface) *MeasurementCommon {
return &MeasurementCommon{
featureRemote: featureRemote,
}
}
var _ api.MeasurementCommonInterface = (*MeasurementCommon)(nil)
// check if spine.EventPayload Data contains data for a given filter
//
// data type will be checked for model.MeasurementListDataType,
// filter type will be checked for model.MeasurementDescriptionDataType
func (m *MeasurementCommon) CheckEventPayloadDataForFilter(payloadData any, filter any) bool {
if payloadData == nil {
return false
}
data, ok := payloadData.(*model.MeasurementListDataType)
filterData, ok2 := filter.(model.MeasurementDescriptionDataType)
if !ok || !ok2 {
return false
}
descs, err := m.GetDescriptionsForFilter(filterData)
if err != nil {
return false
}
for _, desc := range descs {
if desc.MeasurementId == nil {
continue
}
for _, item := range data.MeasurementData {
if item.MeasurementId != nil &&
*item.MeasurementId == *desc.MeasurementId &&
item.Value != nil {
return true
}
}
}
return false
}
// Get the description for a given id
//
// Returns an error if no matching description is found
func (m *MeasurementCommon) GetDescriptionForId(
measurementId model.MeasurementIdType,
) (*model.MeasurementDescriptionDataType, error) {
data, err := m.GetDescriptionsForFilter(model.MeasurementDescriptionDataType{MeasurementId: &measurementId})
if err != nil || len(data) != 1 {
return nil, api.ErrDataNotAvailable
}
return &data[0], nil
}
// Get the description for a given filter
//
// Returns an error if no matching description is found
func (m *MeasurementCommon) GetDescriptionsForFilter(
filter model.MeasurementDescriptionDataType,
) ([]model.MeasurementDescriptionDataType, error) {
function := model.FunctionTypeMeasurementDescriptionListData
data, err := featureDataCopyOfType[model.MeasurementDescriptionListDataType](m.featureLocal, m.featureRemote, function)
if err != nil || data == nil || data.MeasurementDescriptionData == nil {
return nil, api.ErrDataNotAvailable
}
result := searchFilterInList[model.MeasurementDescriptionDataType](data.MeasurementDescriptionData, filter)
return result, nil
}
// Get the constraints for a given filter
//
// Returns an error if no matching constraint is found
func (m *MeasurementCommon) GetConstraintsForFilter(
filter model.MeasurementConstraintsDataType,
) ([]model.MeasurementConstraintsDataType, error) {
function := model.FunctionTypeMeasurementConstraintsListData
data, err := featureDataCopyOfType[model.MeasurementConstraintsListDataType](m.featureLocal, m.featureRemote, function)
if err != nil || data == nil || data.MeasurementConstraintsData == nil {
return nil, api.ErrDataNotAvailable
}
result := searchFilterInList[model.MeasurementConstraintsDataType](data.MeasurementConstraintsData, filter)
return result, nil
}
// Get the measuement data for a given measurementId
//
// Will return nil if no data is available
func (m *MeasurementCommon) GetDataForId(measurementId model.MeasurementIdType) (
*model.MeasurementDataType, error) {
result, err := m.GetDataForFilter(model.MeasurementDescriptionDataType{MeasurementId: &measurementId})
if err != nil || len(result) == 0 {
return nil, api.ErrDataNotAvailable
}
return &result[0], nil
}
// Get measuement data for a given filter
//
// Will return nil if no data is available
func (m *MeasurementCommon) GetDataForFilter(filter model.MeasurementDescriptionDataType) (
[]model.MeasurementDataType, error) {
function := model.FunctionTypeMeasurementListData
descriptions, err := m.GetDescriptionsForFilter(filter)
if err != nil || len(descriptions) == 0 {
return nil, api.ErrDataNotAvailable
}
data, err := featureDataCopyOfType[model.MeasurementListDataType](m.featureLocal, m.featureRemote, function)
if err != nil || data == nil || data.MeasurementData == nil {
return nil, api.ErrDataNotAvailable
}
var result []model.MeasurementDataType
for _, desc := range descriptions {
filter2 := model.MeasurementDataType{
MeasurementId: desc.MeasurementId,
}
elements := searchFilterInList[model.MeasurementDataType](data.MeasurementData, filter2)
result = append(result, elements...)
}
return result, nil
}
@@ -0,0 +1,38 @@
package internal
import (
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type SmartEnergyManagementPsCommon struct {
featureLocal spineapi.FeatureLocalInterface
featureRemote spineapi.FeatureRemoteInterface
}
func NewLocalSmartEnergyManagementPs(featureLocal spineapi.FeatureLocalInterface) *SmartEnergyManagementPsCommon {
return &SmartEnergyManagementPsCommon{
featureLocal: featureLocal,
}
}
func NewRemoteSmartEnergyManagementPs(featureRemote spineapi.FeatureRemoteInterface) *SmartEnergyManagementPsCommon {
return &SmartEnergyManagementPsCommon{
featureRemote: featureRemote,
}
}
var _ api.FeatureServerInterface = (*SmartEnergyManagementPsCommon)(nil)
// return current data for FunctionTypeSmartEnergyManagementPsData
func (i *SmartEnergyManagementPsCommon) GetData() (*model.SmartEnergyManagementPsDataType, error) {
function := model.FunctionTypeSmartEnergyManagementPsData
data, err := featureDataCopyOfType[model.SmartEnergyManagementPsDataType](i.featureLocal, i.featureRemote, function)
if err != nil || data == nil {
return nil, api.ErrDataNotAvailable
}
return data, nil
}
@@ -0,0 +1,80 @@
package internal
import (
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type TimeSeriesCommon struct {
featureLocal spineapi.FeatureLocalInterface
featureRemote spineapi.FeatureRemoteInterface
}
func NewLocalTimeSeries(featureLocal spineapi.FeatureLocalInterface) *TimeSeriesCommon {
return &TimeSeriesCommon{
featureLocal: featureLocal,
}
}
func NewRemoteTimeSeries(featureRemote spineapi.FeatureRemoteInterface) *TimeSeriesCommon {
return &TimeSeriesCommon{
featureRemote: featureRemote,
}
}
var _ api.TimeSeriesCommonInterface = (*TimeSeriesCommon)(nil)
// return list of descriptions for a given filter
func (t *TimeSeriesCommon) GetDescriptionsForFilter(
filter model.TimeSeriesDescriptionDataType,
) ([]model.TimeSeriesDescriptionDataType, error) {
function := model.FunctionTypeTimeSeriesDescriptionListData
data, err := featureDataCopyOfType[model.TimeSeriesDescriptionListDataType](t.featureLocal, t.featureRemote, function)
if err != nil || data == nil || data.TimeSeriesDescriptionData == nil {
return nil, api.ErrDataNotAvailable
}
result := searchFilterInList[model.TimeSeriesDescriptionDataType](data.TimeSeriesDescriptionData, filter)
return result, nil
}
// return current constraints for Time Series
func (t *TimeSeriesCommon) GetConstraints() ([]model.TimeSeriesConstraintsDataType, error) {
function := model.FunctionTypeTimeSeriesConstraintsListData
data, err := featureDataCopyOfType[model.TimeSeriesConstraintsListDataType](t.featureLocal, t.featureRemote, function)
if err != nil {
return nil, api.ErrDataNotAvailable
}
return data.TimeSeriesConstraintsData, nil
}
// return current data for Time Series for a given filter
func (t *TimeSeriesCommon) GetDataForFilter(filter model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error) {
function := model.FunctionTypeTimeSeriesListData
descriptions, err := t.GetDescriptionsForFilter(filter)
if err != nil || len(descriptions) == 0 {
return nil, api.ErrDataNotAvailable
}
data, err := featureDataCopyOfType[model.TimeSeriesListDataType](t.featureLocal, t.featureRemote, function)
if err != nil || data == nil || data.TimeSeriesData == nil {
return nil, api.ErrDataNotAvailable
}
var result []model.TimeSeriesDataType
for _, desc := range descriptions {
filter2 := model.TimeSeriesDataType{
TimeSeriesId: desc.TimeSeriesId,
}
elements := searchFilterInList[model.TimeSeriesDataType](data.TimeSeriesData, filter2)
result = append(result, elements...)
}
return result, nil
}
@@ -0,0 +1,126 @@
package server
import (
"errors"
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
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 DeviceConfiguration struct {
*Feature
*internal.DeviceConfigurationCommon
}
func NewDeviceConfiguration(localEntity spineapi.EntityLocalInterface) (*DeviceConfiguration, error) {
feature, err := NewFeature(model.FeatureTypeTypeDeviceConfiguration, localEntity)
if err != nil {
return nil, err
}
dc := &DeviceConfiguration{
Feature: feature,
DeviceConfigurationCommon: internal.NewLocalDeviceConfiguration(feature.featureLocal),
}
return dc, nil
}
var _ api.DeviceConfigurationServerInterface = (*DeviceConfiguration)(nil)
// Add a new description data set and return the keyId
//
// will return nil if the data set could not be added
func (d *DeviceConfiguration) AddKeyValueDescription(
description model.DeviceConfigurationKeyValueDescriptionDataType,
) *model.DeviceConfigurationKeyIdType {
data, err := spine.LocalFeatureDataCopyOfType[*model.DeviceConfigurationKeyValueDescriptionListDataType](d.featureLocal, model.FunctionTypeDeviceConfigurationKeyValueDescriptionListData)
if err != nil {
data = &model.DeviceConfigurationKeyValueDescriptionListDataType{}
}
var keyId *model.DeviceConfigurationKeyIdType
maxId := model.DeviceConfigurationKeyIdType(0)
for _, item := range data.DeviceConfigurationKeyValueDescriptionData {
if item.KeyId != nil && *item.KeyId >= maxId {
maxId = *item.KeyId + 1
}
}
keyId = util.Ptr(maxId)
description.KeyId = keyId
partial := model.NewFilterTypePartial()
datalist := &model.DeviceConfigurationKeyValueDescriptionListDataType{
DeviceConfigurationKeyValueDescriptionData: []model.DeviceConfigurationKeyValueDescriptionDataType{description},
}
if err := d.featureLocal.UpdateData(model.FunctionTypeDeviceConfigurationKeyValueDescriptionListData, datalist, partial, nil); err != nil {
return nil
}
return keyId
}
// Set or update data set for a keyId
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
func (d *DeviceConfiguration) UpdateKeyValueDataForKeyId(
data model.DeviceConfigurationKeyValueDataType,
deleteElements *model.DeviceConfigurationKeyValueDataElementsType,
keyId model.DeviceConfigurationKeyIdType,
) (resultErr error) {
return d.UpdateKeyValueDataForFilter(data, deleteElements, model.DeviceConfigurationKeyValueDescriptionDataType{KeyId: &keyId})
}
// Set or update data set for a filter
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
func (d *DeviceConfiguration) UpdateKeyValueDataForFilter(
data model.DeviceConfigurationKeyValueDataType,
deleteElements *model.DeviceConfigurationKeyValueDataElementsType,
filter model.DeviceConfigurationKeyValueDescriptionDataType,
) (resultErr error) {
resultErr = api.ErrDataNotAvailable
descriptions, err := d.GetKeyValueDescriptionsForFilter(filter)
if err != nil {
return err
}
if descriptions == nil || len(descriptions) != 1 {
return
}
description := descriptions[0]
data.KeyId = description.KeyId
datalist := &model.DeviceConfigurationKeyValueListDataType{
DeviceConfigurationKeyValueData: []model.DeviceConfigurationKeyValueDataType{data},
}
partial := model.NewFilterTypePartial()
var deleteFilter *model.FilterType
if deleteElements != nil {
deleteFilter = &model.FilterType{
DeviceConfigurationKeyValueListDataSelectors: &model.DeviceConfigurationKeyValueListDataSelectorsType{
KeyId: description.KeyId,
},
DeviceConfigurationKeyValueDataElements: deleteElements,
}
}
if err := d.featureLocal.UpdateData(model.FunctionTypeDeviceConfigurationKeyValueListData, datalist, partial, deleteFilter); err != nil {
return errors.New(err.String())
}
return nil
}
@@ -0,0 +1,35 @@
package server
import (
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type DeviceDiagnosis struct {
*Feature
*internal.DeviceDiagnosisCommon
}
func NewDeviceDiagnosis(localEntity spineapi.EntityLocalInterface) (*DeviceDiagnosis, error) {
feature, err := NewFeature(model.FeatureTypeTypeDeviceConfiguration, localEntity)
if err != nil {
return nil, err
}
dc := &DeviceDiagnosis{
Feature: feature,
DeviceDiagnosisCommon: internal.NewLocalDeviceDiagnosis(feature.featureLocal),
}
return dc, nil
}
var _ api.DeviceDiagnosisServerInterface = (*DeviceDiagnosis)(nil)
// set the local diagnosis state of the device
func (d *DeviceDiagnosis) SetLocalState(operatingState *model.DeviceDiagnosisStateDataType) {
d.featureLocal.SetData(model.FunctionTypeDeviceDiagnosisStateData, operatingState)
}
@@ -0,0 +1,185 @@
package server
import (
"errors"
"github.com/enbility/eebus-go/features/internal"
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 ElectricalConnection struct {
*Feature
*internal.ElectricalConnectionCommon
}
func NewElectricalConnection(localEntity spineapi.EntityLocalInterface) (*ElectricalConnection, error) {
feature, err := NewFeature(model.FeatureTypeTypeElectricalConnection, localEntity)
if err != nil {
return nil, err
}
ec := &ElectricalConnection{
Feature: feature,
ElectricalConnectionCommon: internal.NewLocalElectricalConnection(feature.featureLocal),
}
return ec, nil
}
// Add a new description data set
//
// NOTE: the electricalConnectionId has to be provided
//
// will return nil if the data set could not be added
func (e *ElectricalConnection) AddDescription(
description model.ElectricalConnectionDescriptionDataType,
) error {
if description.ElectricalConnectionId == nil {
return errors.New("missing id data")
}
partial := model.NewFilterTypePartial()
datalist := &model.ElectricalConnectionDescriptionListDataType{
ElectricalConnectionDescriptionData: []model.ElectricalConnectionDescriptionDataType{description},
}
if err := e.featureLocal.UpdateData(model.FunctionTypeElectricalConnectionDescriptionListData, datalist, partial, nil); err != nil {
return errors.New(err.String())
}
return nil
}
// Add a new parameter description data sett and return the parameterId
//
// NOTE: the electricalConnectionId has to be provided, parameterId may not be provided
//
// will return nil if the data set could not be added
func (e *ElectricalConnection) AddParameterDescription(
description model.ElectricalConnectionParameterDescriptionDataType,
) *model.ElectricalConnectionParameterIdType {
if description.ElectricalConnectionId == nil || description.ParameterId != nil {
return nil
}
filter := model.ElectricalConnectionParameterDescriptionDataType{
ElectricalConnectionId: description.ElectricalConnectionId,
}
data, _ := e.GetParameterDescriptionsForFilter(filter)
maxId := model.ElectricalConnectionParameterIdType(0)
for _, item := range data {
if item.ParameterId != nil && *item.ParameterId >= maxId {
maxId = *item.ParameterId + 1
}
}
parameterId := util.Ptr(maxId)
description.ParameterId = parameterId
partial := model.NewFilterTypePartial()
datalist := &model.ElectricalConnectionParameterDescriptionListDataType{
ElectricalConnectionParameterDescriptionData: []model.ElectricalConnectionParameterDescriptionDataType{description},
}
if err := e.featureLocal.UpdateData(model.FunctionTypeElectricalConnectionParameterDescriptionListData, datalist, partial, nil); err != nil {
return nil
}
return parameterId
}
// Add a new characteristic data set
//
// Note: ElectricalConnectionId and ParameterId must be set, CharacteristicId will be set automatically
//
// Will return an error if the data set could not be added
func (e *ElectricalConnection) AddCharacteristic(data model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error) {
if data.ElectricalConnectionId == nil ||
data.ParameterId == nil {
return nil, errors.New("missing id data")
}
if data.CharacteristicId != nil {
return nil, errors.New("characteristic id must not be set")
}
maxId := model.ElectricalConnectionCharacteristicIdType(0)
listData, err := spine.LocalFeatureDataCopyOfType[*model.ElectricalConnectionCharacteristicListDataType](e.featureLocal, model.FunctionTypeElectricalConnectionCharacteristicListData)
if err != nil {
listData = &model.ElectricalConnectionCharacteristicListDataType{}
}
for _, item := range listData.ElectricalConnectionCharacteristicData {
if item.CharacteristicId != nil && *item.CharacteristicId >= maxId {
maxId = *item.CharacteristicId + 1
}
}
charId := util.Ptr(maxId)
data.CharacteristicId = charId
datalist := &model.ElectricalConnectionCharacteristicListDataType{
ElectricalConnectionCharacteristicData: []model.ElectricalConnectionCharacteristicDataType{data},
}
partial := model.NewFilterTypePartial()
if err := e.featureLocal.UpdateData(model.FunctionTypeElectricalConnectionCharacteristicListData, datalist, partial, nil); err != nil {
return nil, errors.New(err.String())
}
return charId, nil
}
// Update data set for a filter
// Elements provided in deleteElements will be removed from the data set before the update
//
// // ElectricalConnectionId, ParameterId and CharacteristicId must be set
//
// Will return an error if the data set could not be updated
func (e *ElectricalConnection) UpdateCharacteristic(
data model.ElectricalConnectionCharacteristicDataType,
deleteElements *model.ElectricalConnectionCharacteristicDataElementsType,
) error {
if data.CharacteristicId == nil ||
data.ElectricalConnectionId == nil ||
data.ParameterId == nil {
return errors.New("missing id data")
}
filter := model.ElectricalConnectionCharacteristicDataType{
ElectricalConnectionId: data.ElectricalConnectionId,
ParameterId: data.ParameterId,
CharacteristicId: data.CharacteristicId,
}
chars, err := e.GetCharacteristicsForFilter(filter)
if err != nil || chars == nil || len(chars) != 1 {
return errors.New("no matching element found")
}
partial := model.NewFilterTypePartial()
var deleteFilter *model.FilterType
if deleteElements != nil {
deleteFilter = &model.FilterType{
ElectricalConnectionCharacteristicListDataSelectors: &model.ElectricalConnectionCharacteristicListDataSelectorsType{
CharacteristicId: data.CharacteristicId,
},
ElectricalConnectionCharacteristicDataElements: deleteElements,
}
}
datalist := &model.ElectricalConnectionCharacteristicListDataType{
ElectricalConnectionCharacteristicData: []model.ElectricalConnectionCharacteristicDataType{data},
}
if err := e.featureLocal.UpdateData(model.FunctionTypeElectricalConnectionCharacteristicListData, datalist, partial, deleteFilter); err != nil {
return errors.New(err.String())
}
return nil
}
@@ -0,0 +1,43 @@
package server
import (
"errors"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
)
type Feature struct {
featureType model.FeatureTypeType
localRole model.RoleType
spineLocalDevice spineapi.DeviceLocalInterface
localEntity spineapi.EntityLocalInterface
featureLocal spineapi.FeatureLocalInterface
}
// var _ api.FeatureServerInterface = (*Feature)(nil)
func NewFeature(
featureType model.FeatureTypeType,
localEntity spineapi.EntityLocalInterface) (*Feature, error) {
if localEntity == nil {
return nil, errors.New("local entity is nil")
}
f := &Feature{
featureType: featureType,
localRole: model.RoleTypeServer,
spineLocalDevice: localEntity.Device(),
localEntity: localEntity,
}
f.featureLocal = f.localEntity.FeatureOfTypeAndRole(f.featureType, f.localRole)
if f.featureLocal == nil {
return nil, errors.New("local feature not found")
}
return f, nil
}
@@ -0,0 +1,124 @@
package server
import (
"errors"
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
"github.com/enbility/spine-go/util"
)
type LoadControl struct {
*Feature
*internal.LoadControlCommon
}
func NewLoadControl(localEntity spineapi.EntityLocalInterface) (*LoadControl, error) {
feature, err := NewFeature(model.FeatureTypeTypeLoadControl, localEntity)
if err != nil {
return nil, err
}
lc := &LoadControl{
Feature: feature,
LoadControlCommon: internal.NewLocalLoadControl(feature.featureLocal),
}
return lc, nil
}
// Add a new description data set and return the limitId
//
// NOTE: the limitId may not be provided
//
// will return nil if the data set could not be added
func (l *LoadControl) AddLimitDescription(
description model.LoadControlLimitDescriptionDataType,
) *model.LoadControlLimitIdType {
if description.LimitId != nil {
return nil
}
data, err := l.GetLimitDescriptionsForFilter(model.LoadControlLimitDescriptionDataType{})
if err != nil {
data = []model.LoadControlLimitDescriptionDataType{}
}
maxId := model.LoadControlLimitIdType(0)
for _, item := range data {
if item.LimitId != nil && *item.LimitId >= maxId {
maxId = *item.LimitId + 1
}
}
limitId := util.Ptr(maxId)
description.LimitId = limitId
partial := model.NewFilterTypePartial()
datalist := &model.LoadControlLimitDescriptionListDataType{
LoadControlLimitDescriptionData: []model.LoadControlLimitDescriptionDataType{description},
}
if err := l.featureLocal.UpdateData(model.FunctionTypeLoadControlLimitDescriptionListData, datalist, partial, nil); err != nil {
return nil
}
return limitId
}
// Set or update data set for a limitId
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
func (l *LoadControl) UpdateLimitDataForId(
data model.LoadControlLimitDataType,
deleteElements *model.LoadControlLimitDataElementsType,
limitId model.LoadControlLimitIdType,
) (resultErr error) {
return l.UpdateLimitDataForFilter(data, deleteElements, model.LoadControlLimitDescriptionDataType{LimitId: &limitId})
}
// Set or update data set for a filter
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
func (l *LoadControl) UpdateLimitDataForFilter(
data model.LoadControlLimitDataType,
deleteElements *model.LoadControlLimitDataElementsType,
filter model.LoadControlLimitDescriptionDataType,
) (resultErr error) {
resultErr = api.ErrDataNotAvailable
descriptions, err := l.GetLimitDescriptionsForFilter(filter)
if err != nil || descriptions == nil || len(descriptions) != 1 {
return
}
description := descriptions[0]
data.LimitId = description.LimitId
datalist := &model.LoadControlLimitListDataType{
LoadControlLimitData: []model.LoadControlLimitDataType{data},
}
partial := model.NewFilterTypePartial()
var deleteFilter *model.FilterType
if deleteElements != nil {
deleteFilter = &model.FilterType{
LoadControlLimitListDataSelectors: &model.LoadControlLimitListDataSelectorsType{
LimitId: description.LimitId,
},
LoadControlLimitDataElements: deleteElements,
}
}
if err := l.featureLocal.UpdateData(model.FunctionTypeLoadControlLimitListData, datalist, partial, deleteFilter); err != nil {
return errors.New(err.String())
}
return nil
}
@@ -0,0 +1,126 @@
package server
import (
"errors"
"github.com/enbility/eebus-go/api"
"github.com/enbility/eebus-go/features/internal"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
"github.com/enbility/spine-go/util"
)
type Measurement struct {
*Feature
*internal.MeasurementCommon
}
func NewMeasurement(localEntity spineapi.EntityLocalInterface) (*Measurement, error) {
feature, err := NewFeature(model.FeatureTypeTypeMeasurement, localEntity)
if err != nil {
return nil, err
}
m := &Measurement{
Feature: feature,
MeasurementCommon: internal.NewLocalMeasurement(feature.featureLocal),
}
return m, nil
}
var _ api.MeasurementServerInterface = (*Measurement)(nil)
// Add a new parameter description data sett and return the measurementId
//
// NOTE: the measurementId may not be provided
//
// will return nil if the data set could not be added
func (m *Measurement) AddDescription(
description model.MeasurementDescriptionDataType,
) *model.MeasurementIdType {
if description.MeasurementId != nil {
return nil
}
data, err := m.GetDescriptionsForFilter(model.MeasurementDescriptionDataType{})
if err != nil {
data = []model.MeasurementDescriptionDataType{}
}
maxId := model.MeasurementIdType(0)
for _, item := range data {
if item.MeasurementId != nil && *item.MeasurementId >= maxId {
maxId = *item.MeasurementId + 1
}
}
measurementId := util.Ptr(maxId)
description.MeasurementId = measurementId
partial := model.NewFilterTypePartial()
datalist := &model.MeasurementDescriptionListDataType{
MeasurementDescriptionData: []model.MeasurementDescriptionDataType{description},
}
if err := m.featureLocal.UpdateData(model.FunctionTypeMeasurementDescriptionListData, datalist, partial, nil); err != nil {
return nil
}
return measurementId
}
// Set or update data set for a measurementId
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
func (m *Measurement) UpdateDataForId(
data model.MeasurementDataType,
deleteElements *model.MeasurementDataElementsType,
measurementId model.MeasurementIdType,
) (resultErr error) {
return m.UpdateDataForFilter(data, deleteElements, model.MeasurementDescriptionDataType{MeasurementId: &measurementId})
}
// Set or update data set for a filter
// Elements provided in deleteElements will be removed from the data set before the update
//
// Will return an error if the data set could not be updated
func (m *Measurement) UpdateDataForFilter(
data model.MeasurementDataType,
deleteElements *model.MeasurementDataElementsType,
filter model.MeasurementDescriptionDataType,
) (resultErr error) {
resultErr = api.ErrDataNotAvailable
descriptions, err := m.GetDescriptionsForFilter(filter)
if err != nil || descriptions == nil || len(descriptions) != 1 {
return
}
description := descriptions[0]
data.MeasurementId = description.MeasurementId
datalist := &model.MeasurementListDataType{
MeasurementData: []model.MeasurementDataType{data},
}
partial := model.NewFilterTypePartial()
var deleteFilter *model.FilterType
if deleteElements != nil {
deleteFilter = &model.FilterType{
MeasurementListDataSelectors: &model.MeasurementListDataSelectorsType{
MeasurementId: description.MeasurementId,
},
MeasurementDataElements: deleteElements,
}
}
if err := m.featureLocal.UpdateData(model.FunctionTypeMeasurementListData, datalist, partial, deleteFilter); err != nil {
return errors.New(err.String())
}
return nil
}
+37
View File
@@ -0,0 +1,37 @@
module github.com/enbility/eebus-go
go 1.22.0
require (
github.com/enbility/ship-go v0.6.0
github.com/enbility/spine-go v0.7.0
github.com/stretchr/testify v1.9.0
)
require (
github.com/ahmetb/go-linq/v3 v3.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/enbility/go-avahi v0.0.0-20240909195612-d5de6b280d7a // indirect
github.com/enbility/zeroconf/v2 v2.0.0-20240920094356-be1cae74fda6 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/golanguzb70/lrucache v1.2.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/miekg/dns v1.1.62 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rickb777/date v1.21.1 // indirect
github.com/rickb777/plural v1.4.2 // indirect
github.com/stretchr/objx v0.5.2 // indirect
gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a // indirect
go.uber.org/mock v0.4.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/tools v0.25.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
retract (
v0.2.2 // Contains retractions only.
v0.2.1 // Published accidentally.
)
+54
View File
@@ -0,0 +1,54 @@
github.com/ahmetb/go-linq/v3 v3.2.0 h1:BEuMfp+b59io8g5wYzNoFe9pWPalRklhlhbiU3hYZDE=
github.com/ahmetb/go-linq/v3 v3.2.0/go.mod h1:haQ3JfOeWK8HpVxMtHHEMPVgBKiYyQ+f1/kLZh/cj9U=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/enbility/go-avahi v0.0.0-20240909195612-d5de6b280d7a h1:foChWb8lhzqa6lWDRs6COYMdp649YlUirFP8GqoT0JQ=
github.com/enbility/go-avahi v0.0.0-20240909195612-d5de6b280d7a/go.mod h1:H64mhYcAQUGUUnVqMdZQf93kPecH4M79xwH95Lddt3U=
github.com/enbility/ship-go v0.6.0 h1:1ft5NJJHqqGU3/ryYwQj8xBYJLFbf0q2cP9mjlYHlgw=
github.com/enbility/ship-go v0.6.0/go.mod h1:JJp8EQcJhUhTpZ2LSEU4rpdaM3E2n08tswWFWtmm/wU=
github.com/enbility/spine-go v0.7.0 h1:UZeghFgnM3VFU0ghc57Htt6gnxwP9jLppfU2GUMJGgY=
github.com/enbility/spine-go v0.7.0/go.mod h1:IF1sBTr7p3wXqlejeBJcJ8BYFlzzRaZcJsGw8XjgEgc=
github.com/enbility/zeroconf/v2 v2.0.0-20240920094356-be1cae74fda6 h1:XOYvxKtT1oxT37w/5oEiRLuPbm9FuJPt3fiYhX0h8Po=
github.com/enbility/zeroconf/v2 v2.0.0-20240920094356-be1cae74fda6/go.mod h1:BszP9qFV14mPXgyIREbgIdQtWxbAj3OKqvK02HihMoM=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golanguzb70/lrucache v1.2.0 h1:VjpjmB4VTf9VXBtZTJGcgcN0CNFM5egDrrSjkGyQOlg=
github.com/golanguzb70/lrucache v1.2.0/go.mod h1:zc2GD26KwGEDdTHsCCTcJorv/11HyKwQVS9gqg2bizc=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ=
github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ=
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rickb777/date v1.21.1 h1:tUcQS8riIRoYK5kUAv5aevllFEYUEk2x8OYDyoldOn4=
github.com/rickb777/date v1.21.1/go.mod h1:gnDexsbXViZr2fCKMrY3m6IfAF5U2vSkEaiGJcNFaLQ=
github.com/rickb777/plural v1.4.2 h1:Kl/syFGLFZ5EbuV8c9SVud8s5HI2HpCCtOMw2U1kS+A=
github.com/rickb777/plural v1.4.2/go.mod h1:kdmXUpmKBJTS0FtG/TFumd//VBWsNTD7zOw7x4umxNw=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a h1:DxppxFKRqJ8WD6oJ3+ZXKDY0iMONQDl5UTg2aTyHh8k=
gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a/go.mod h1:NREvu3a57BaK0R1+ztrEzHWiZAihohNLQ6trPxlIqZI=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
@@ -0,0 +1,92 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// DeviceClassificationClientInterface is an autogenerated mock type for the DeviceClassificationClientInterface type
type DeviceClassificationClientInterface struct {
mock.Mock
}
type DeviceClassificationClientInterface_Expecter struct {
mock *mock.Mock
}
func (_m *DeviceClassificationClientInterface) EXPECT() *DeviceClassificationClientInterface_Expecter {
return &DeviceClassificationClientInterface_Expecter{mock: &_m.Mock}
}
// RequestManufacturerDetails provides a mock function with given fields:
func (_m *DeviceClassificationClientInterface) RequestManufacturerDetails() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RequestManufacturerDetails")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceClassificationClientInterface_RequestManufacturerDetails_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestManufacturerDetails'
type DeviceClassificationClientInterface_RequestManufacturerDetails_Call struct {
*mock.Call
}
// RequestManufacturerDetails is a helper method to define mock.On call
func (_e *DeviceClassificationClientInterface_Expecter) RequestManufacturerDetails() *DeviceClassificationClientInterface_RequestManufacturerDetails_Call {
return &DeviceClassificationClientInterface_RequestManufacturerDetails_Call{Call: _e.mock.On("RequestManufacturerDetails")}
}
func (_c *DeviceClassificationClientInterface_RequestManufacturerDetails_Call) Run(run func()) *DeviceClassificationClientInterface_RequestManufacturerDetails_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *DeviceClassificationClientInterface_RequestManufacturerDetails_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceClassificationClientInterface_RequestManufacturerDetails_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *DeviceClassificationClientInterface_RequestManufacturerDetails_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *DeviceClassificationClientInterface_RequestManufacturerDetails_Call {
_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
}
@@ -0,0 +1,92 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// DeviceClassificationCommonInterface is an autogenerated mock type for the DeviceClassificationCommonInterface type
type DeviceClassificationCommonInterface struct {
mock.Mock
}
type DeviceClassificationCommonInterface_Expecter struct {
mock *mock.Mock
}
func (_m *DeviceClassificationCommonInterface) EXPECT() *DeviceClassificationCommonInterface_Expecter {
return &DeviceClassificationCommonInterface_Expecter{mock: &_m.Mock}
}
// GetManufacturerDetails provides a mock function with given fields:
func (_m *DeviceClassificationCommonInterface) GetManufacturerDetails() (*model.DeviceClassificationManufacturerDataType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetManufacturerDetails")
}
var r0 *model.DeviceClassificationManufacturerDataType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.DeviceClassificationManufacturerDataType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceClassificationCommonInterface_GetManufacturerDetails_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetManufacturerDetails'
type DeviceClassificationCommonInterface_GetManufacturerDetails_Call struct {
*mock.Call
}
// GetManufacturerDetails is a helper method to define mock.On call
func (_e *DeviceClassificationCommonInterface_Expecter) GetManufacturerDetails() *DeviceClassificationCommonInterface_GetManufacturerDetails_Call {
return &DeviceClassificationCommonInterface_GetManufacturerDetails_Call{Call: _e.mock.On("GetManufacturerDetails")}
}
func (_c *DeviceClassificationCommonInterface_GetManufacturerDetails_Call) Run(run func()) *DeviceClassificationCommonInterface_GetManufacturerDetails_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *DeviceClassificationCommonInterface_GetManufacturerDetails_Call) Return(_a0 *model.DeviceClassificationManufacturerDataType, _a1 error) *DeviceClassificationCommonInterface_GetManufacturerDetails_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *DeviceClassificationCommonInterface_GetManufacturerDetails_Call) RunAndReturn(run func() (*model.DeviceClassificationManufacturerDataType, error)) *DeviceClassificationCommonInterface_GetManufacturerDetails_Call {
_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
}
@@ -0,0 +1,32 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
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}
}
// 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.
func NewDeviceClassificationServerInterface(t interface {
mock.TestingT
Cleanup(func())
}) *DeviceClassificationServerInterface {
mock := &DeviceClassificationServerInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,490 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// DeviceConfigurationClientInterface is an autogenerated mock type for the DeviceConfigurationClientInterface type
type DeviceConfigurationClientInterface struct {
mock.Mock
}
type DeviceConfigurationClientInterface_Expecter struct {
mock *mock.Mock
}
func (_m *DeviceConfigurationClientInterface) EXPECT() *DeviceConfigurationClientInterface_Expecter {
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)
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)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckEventPayloadDataForFilter'
type DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call struct {
*mock.Call
}
// CheckEventPayloadDataForFilter is a helper method to define mock.On call
// - 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 interface{}, filter interface{})) *DeviceConfigurationClientInterface_CheckEventPayloadDataForFilter_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(interface{}), args[1].(interface{}))
})
return _c
}
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(interface{}, interface{}) 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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDataForFilter")
}
var r0 *model.DeviceConfigurationKeyValueDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDataForFilter'
type DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call struct {
*mock.Call
}
// GetKeyValueDataForFilter is a helper method to define mock.On call
// - filter model.DeviceConfigurationKeyValueDescriptionDataType
func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDataForFilter(filter interface{}) *DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call {
return &DeviceConfigurationClientInterface_GetKeyValueDataForFilter_Call{Call: _e.mock.On("GetKeyValueDataForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDataForKeyId")
}
var r0 *model.DeviceConfigurationKeyValueDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok {
r1 = rf(keyId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDataForKeyId'
type DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call struct {
*mock.Call
}
// GetKeyValueDataForKeyId is a helper method to define mock.On call
// - keyId model.DeviceConfigurationKeyIdType
func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDataForKeyId(keyId interface{}) *DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call {
return &DeviceConfigurationClientInterface_GetKeyValueDataForKeyId_Call{Call: _e.mock.On("GetKeyValueDataForKeyId", keyId)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDescriptionFoKeyId")
}
var r0 *model.DeviceConfigurationKeyValueDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok {
r1 = rf(keyId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDescriptionFoKeyId'
type DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call struct {
*mock.Call
}
// GetKeyValueDescriptionFoKeyId is a helper method to define mock.On call
// - keyId model.DeviceConfigurationKeyIdType
func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDescriptionFoKeyId(keyId interface{}) *DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call {
return &DeviceConfigurationClientInterface_GetKeyValueDescriptionFoKeyId_Call{Call: _e.mock.On("GetKeyValueDescriptionFoKeyId", keyId)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDescriptionsForFilter")
}
var r0 []model.DeviceConfigurationKeyValueDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDescriptionsForFilter'
type DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call struct {
*mock.Call
}
// GetKeyValueDescriptionsForFilter is a helper method to define mock.On call
// - filter model.DeviceConfigurationKeyValueDescriptionDataType
func (_e *DeviceConfigurationClientInterface_Expecter) GetKeyValueDescriptionsForFilter(filter interface{}) *DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call {
return &DeviceConfigurationClientInterface_GetKeyValueDescriptionsForFilter_Call{Call: _e.mock.On("GetKeyValueDescriptionsForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for RequestKeyValueDescriptions")
}
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 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 rf, ok := ret.Get(1).(func(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *model.DeviceConfigurationKeyValueDescriptionDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestKeyValueDescriptions'
type DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call struct {
*mock.Call
}
// RequestKeyValueDescriptions is a helper method to define mock.On call
// - selector *model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType
// - elements *model.DeviceConfigurationKeyValueDescriptionDataElementsType
func (_e *DeviceConfigurationClientInterface_Expecter) RequestKeyValueDescriptions(selector interface{}, elements interface{}) *DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call {
return &DeviceConfigurationClientInterface_RequestKeyValueDescriptions_Call{Call: _e.mock.On("RequestKeyValueDescriptions", selector, elements)}
}
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))
})
return _c
}
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(*model.DeviceConfigurationKeyValueDescriptionListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for RequestKeyValues")
}
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 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 rf, ok := ret.Get(1).(func(*model.DeviceConfigurationKeyValueListDataSelectorsType, *model.DeviceConfigurationKeyValueDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationClientInterface_RequestKeyValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestKeyValues'
type DeviceConfigurationClientInterface_RequestKeyValues_Call struct {
*mock.Call
}
// RequestKeyValues is a helper method to define mock.On call
// - selector *model.DeviceConfigurationKeyValueListDataSelectorsType
// - elements *model.DeviceConfigurationKeyValueDataElementsType
func (_e *DeviceConfigurationClientInterface_Expecter) RequestKeyValues(selector interface{}, elements interface{}) *DeviceConfigurationClientInterface_RequestKeyValues_Call {
return &DeviceConfigurationClientInterface_RequestKeyValues_Call{Call: _e.mock.On("RequestKeyValues", selector, elements)}
}
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))
})
return _c
}
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(*model.DeviceConfigurationKeyValueListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for WriteKeyValues")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func([]model.DeviceConfigurationKeyValueDataType) (*model.MsgCounterType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func([]model.DeviceConfigurationKeyValueDataType) error); ok {
r1 = rf(data)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationClientInterface_WriteKeyValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteKeyValues'
type DeviceConfigurationClientInterface_WriteKeyValues_Call struct {
*mock.Call
}
// WriteKeyValues is a helper method to define mock.On call
// - data []model.DeviceConfigurationKeyValueDataType
func (_e *DeviceConfigurationClientInterface_Expecter) WriteKeyValues(data interface{}) *DeviceConfigurationClientInterface_WriteKeyValues_Call {
return &DeviceConfigurationClientInterface_WriteKeyValues_Call{Call: _e.mock.On("WriteKeyValues", data)}
}
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))
})
return _c
}
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([]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
}
@@ -0,0 +1,314 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// DeviceConfigurationCommonInterface is an autogenerated mock type for the DeviceConfigurationCommonInterface type
type DeviceConfigurationCommonInterface struct {
mock.Mock
}
type DeviceConfigurationCommonInterface_Expecter struct {
mock *mock.Mock
}
func (_m *DeviceConfigurationCommonInterface) EXPECT() *DeviceConfigurationCommonInterface_Expecter {
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)
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)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckEventPayloadDataForFilter'
type DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call struct {
*mock.Call
}
// CheckEventPayloadDataForFilter is a helper method to define mock.On call
// - 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 interface{}, filter interface{})) *DeviceConfigurationCommonInterface_CheckEventPayloadDataForFilter_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(interface{}), args[1].(interface{}))
})
return _c
}
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(interface{}, interface{}) 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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDataForFilter")
}
var r0 *model.DeviceConfigurationKeyValueDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDataForFilter'
type DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call struct {
*mock.Call
}
// GetKeyValueDataForFilter is a helper method to define mock.On call
// - filter model.DeviceConfigurationKeyValueDescriptionDataType
func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDataForFilter(filter interface{}) *DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call {
return &DeviceConfigurationCommonInterface_GetKeyValueDataForFilter_Call{Call: _e.mock.On("GetKeyValueDataForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDataForKeyId")
}
var r0 *model.DeviceConfigurationKeyValueDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok {
r1 = rf(keyId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDataForKeyId'
type DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call struct {
*mock.Call
}
// GetKeyValueDataForKeyId is a helper method to define mock.On call
// - keyId model.DeviceConfigurationKeyIdType
func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDataForKeyId(keyId interface{}) *DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call {
return &DeviceConfigurationCommonInterface_GetKeyValueDataForKeyId_Call{Call: _e.mock.On("GetKeyValueDataForKeyId", keyId)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDescriptionFoKeyId")
}
var r0 *model.DeviceConfigurationKeyValueDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok {
r1 = rf(keyId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDescriptionFoKeyId'
type DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call struct {
*mock.Call
}
// GetKeyValueDescriptionFoKeyId is a helper method to define mock.On call
// - keyId model.DeviceConfigurationKeyIdType
func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDescriptionFoKeyId(keyId interface{}) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call {
return &DeviceConfigurationCommonInterface_GetKeyValueDescriptionFoKeyId_Call{Call: _e.mock.On("GetKeyValueDescriptionFoKeyId", keyId)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDescriptionsForFilter")
}
var r0 []model.DeviceConfigurationKeyValueDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDescriptionsForFilter'
type DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call struct {
*mock.Call
}
// GetKeyValueDescriptionsForFilter is a helper method to define mock.On call
// - filter model.DeviceConfigurationKeyValueDescriptionDataType
func (_e *DeviceConfigurationCommonInterface_Expecter) GetKeyValueDescriptionsForFilter(filter interface{}) *DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call {
return &DeviceConfigurationCommonInterface_GetKeyValueDescriptionsForFilter_Call{Call: _e.mock.On("GetKeyValueDescriptionsForFilter", filter)}
}
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))
})
return _c
}
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(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
}
@@ -0,0 +1,458 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// DeviceConfigurationServerInterface is an autogenerated mock type for the DeviceConfigurationServerInterface type
type DeviceConfigurationServerInterface struct {
mock.Mock
}
type DeviceConfigurationServerInterface_Expecter struct {
mock *mock.Mock
}
func (_m *DeviceConfigurationServerInterface) EXPECT() *DeviceConfigurationServerInterface_Expecter {
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)
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)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.DeviceConfigurationKeyIdType)
}
}
return r0
}
// DeviceConfigurationServerInterface_AddKeyValueDescription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddKeyValueDescription'
type DeviceConfigurationServerInterface_AddKeyValueDescription_Call struct {
*mock.Call
}
// AddKeyValueDescription is a helper method to define mock.On call
// - description model.DeviceConfigurationKeyValueDescriptionDataType
func (_e *DeviceConfigurationServerInterface_Expecter) AddKeyValueDescription(description interface{}) *DeviceConfigurationServerInterface_AddKeyValueDescription_Call {
return &DeviceConfigurationServerInterface_AddKeyValueDescription_Call{Call: _e.mock.On("AddKeyValueDescription", description)}
}
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))
})
return _c
}
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(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)
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)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckEventPayloadDataForFilter'
type DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call struct {
*mock.Call
}
// CheckEventPayloadDataForFilter is a helper method to define mock.On call
// - 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 interface{}, filter interface{})) *DeviceConfigurationServerInterface_CheckEventPayloadDataForFilter_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(interface{}), args[1].(interface{}))
})
return _c
}
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(interface{}, interface{}) 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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDataForFilter")
}
var r0 *model.DeviceConfigurationKeyValueDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) (*model.DeviceConfigurationKeyValueDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDataForFilter'
type DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call struct {
*mock.Call
}
// GetKeyValueDataForFilter is a helper method to define mock.On call
// - filter model.DeviceConfigurationKeyValueDescriptionDataType
func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDataForFilter(filter interface{}) *DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call {
return &DeviceConfigurationServerInterface_GetKeyValueDataForFilter_Call{Call: _e.mock.On("GetKeyValueDataForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDataForKeyId")
}
var r0 *model.DeviceConfigurationKeyValueDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok {
r1 = rf(keyId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDataForKeyId'
type DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call struct {
*mock.Call
}
// GetKeyValueDataForKeyId is a helper method to define mock.On call
// - keyId model.DeviceConfigurationKeyIdType
func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDataForKeyId(keyId interface{}) *DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call {
return &DeviceConfigurationServerInterface_GetKeyValueDataForKeyId_Call{Call: _e.mock.On("GetKeyValueDataForKeyId", keyId)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDescriptionFoKeyId")
}
var r0 *model.DeviceConfigurationKeyValueDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyIdType) (*model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyIdType) error); ok {
r1 = rf(keyId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDescriptionFoKeyId'
type DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call struct {
*mock.Call
}
// GetKeyValueDescriptionFoKeyId is a helper method to define mock.On call
// - keyId model.DeviceConfigurationKeyIdType
func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDescriptionFoKeyId(keyId interface{}) *DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call {
return &DeviceConfigurationServerInterface_GetKeyValueDescriptionFoKeyId_Call{Call: _e.mock.On("GetKeyValueDescriptionFoKeyId", keyId)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetKeyValueDescriptionsForFilter")
}
var r0 []model.DeviceConfigurationKeyValueDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.DeviceConfigurationKeyValueDescriptionDataType) ([]model.DeviceConfigurationKeyValueDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.DeviceConfigurationKeyValueDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyValueDescriptionsForFilter'
type DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call struct {
*mock.Call
}
// GetKeyValueDescriptionsForFilter is a helper method to define mock.On call
// - filter model.DeviceConfigurationKeyValueDescriptionDataType
func (_e *DeviceConfigurationServerInterface_Expecter) GetKeyValueDescriptionsForFilter(filter interface{}) *DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call {
return &DeviceConfigurationServerInterface_GetKeyValueDescriptionsForFilter_Call{Call: _e.mock.On("GetKeyValueDescriptionsForFilter", filter)}
}
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))
})
return _c
}
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(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)
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)
} else {
r0 = ret.Error(0)
}
return r0
}
// DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateKeyValueDataForFilter'
type DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call struct {
*mock.Call
}
// UpdateKeyValueDataForFilter is a helper method to define mock.On call
// - data model.DeviceConfigurationKeyValueDataType
// - deleteElements *model.DeviceConfigurationKeyValueDataElementsType
// - filter model.DeviceConfigurationKeyValueDescriptionDataType
func (_e *DeviceConfigurationServerInterface_Expecter) UpdateKeyValueDataForFilter(data interface{}, deleteElements interface{}, filter interface{}) *DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call {
return &DeviceConfigurationServerInterface_UpdateKeyValueDataForFilter_Call{Call: _e.mock.On("UpdateKeyValueDataForFilter", data, deleteElements, filter)}
}
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))
})
return _c
}
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(model.DeviceConfigurationKeyValueDataType, *model.DeviceConfigurationKeyValueDataElementsType, 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)
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)
} else {
r0 = ret.Error(0)
}
return r0
}
// DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateKeyValueDataForKeyId'
type DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call struct {
*mock.Call
}
// UpdateKeyValueDataForKeyId is a helper method to define mock.On call
// - data model.DeviceConfigurationKeyValueDataType
// - deleteElements *model.DeviceConfigurationKeyValueDataElementsType
// - keyId model.DeviceConfigurationKeyIdType
func (_e *DeviceConfigurationServerInterface_Expecter) UpdateKeyValueDataForKeyId(data interface{}, deleteElements interface{}, keyId interface{}) *DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call {
return &DeviceConfigurationServerInterface_UpdateKeyValueDataForKeyId_Call{Call: _e.mock.On("UpdateKeyValueDataForKeyId", data, deleteElements, keyId)}
}
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))
})
return _c
}
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(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
}
@@ -0,0 +1,149 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// DeviceDiagnosisClientInterface is an autogenerated mock type for the DeviceDiagnosisClientInterface type
type DeviceDiagnosisClientInterface struct {
mock.Mock
}
type DeviceDiagnosisClientInterface_Expecter struct {
mock *mock.Mock
}
func (_m *DeviceDiagnosisClientInterface) EXPECT() *DeviceDiagnosisClientInterface_Expecter {
return &DeviceDiagnosisClientInterface_Expecter{mock: &_m.Mock}
}
// RequestHeartbeat provides a mock function with given fields:
func (_m *DeviceDiagnosisClientInterface) RequestHeartbeat() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RequestHeartbeat")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceDiagnosisClientInterface_RequestHeartbeat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestHeartbeat'
type DeviceDiagnosisClientInterface_RequestHeartbeat_Call struct {
*mock.Call
}
// RequestHeartbeat is a helper method to define mock.On call
func (_e *DeviceDiagnosisClientInterface_Expecter) RequestHeartbeat() *DeviceDiagnosisClientInterface_RequestHeartbeat_Call {
return &DeviceDiagnosisClientInterface_RequestHeartbeat_Call{Call: _e.mock.On("RequestHeartbeat")}
}
func (_c *DeviceDiagnosisClientInterface_RequestHeartbeat_Call) Run(run func()) *DeviceDiagnosisClientInterface_RequestHeartbeat_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *DeviceDiagnosisClientInterface_RequestHeartbeat_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceDiagnosisClientInterface_RequestHeartbeat_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *DeviceDiagnosisClientInterface_RequestHeartbeat_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *DeviceDiagnosisClientInterface_RequestHeartbeat_Call {
_c.Call.Return(run)
return _c
}
// RequestState provides a mock function with given fields:
func (_m *DeviceDiagnosisClientInterface) RequestState() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RequestState")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceDiagnosisClientInterface_RequestState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestState'
type DeviceDiagnosisClientInterface_RequestState_Call struct {
*mock.Call
}
// RequestState is a helper method to define mock.On call
func (_e *DeviceDiagnosisClientInterface_Expecter) RequestState() *DeviceDiagnosisClientInterface_RequestState_Call {
return &DeviceDiagnosisClientInterface_RequestState_Call{Call: _e.mock.On("RequestState")}
}
func (_c *DeviceDiagnosisClientInterface_RequestState_Call) Run(run func()) *DeviceDiagnosisClientInterface_RequestState_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *DeviceDiagnosisClientInterface_RequestState_Call) Return(_a0 *model.MsgCounterType, _a1 error) *DeviceDiagnosisClientInterface_RequestState_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *DeviceDiagnosisClientInterface_RequestState_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *DeviceDiagnosisClientInterface_RequestState_Call {
_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
}
@@ -0,0 +1,140 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
time "time"
)
// DeviceDiagnosisCommonInterface is an autogenerated mock type for the DeviceDiagnosisCommonInterface type
type DeviceDiagnosisCommonInterface struct {
mock.Mock
}
type DeviceDiagnosisCommonInterface_Expecter struct {
mock *mock.Mock
}
func (_m *DeviceDiagnosisCommonInterface) EXPECT() *DeviceDiagnosisCommonInterface_Expecter {
return &DeviceDiagnosisCommonInterface_Expecter{mock: &_m.Mock}
}
// GetState provides a mock function with given fields:
func (_m *DeviceDiagnosisCommonInterface) GetState() (*model.DeviceDiagnosisStateDataType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetState")
}
var r0 *model.DeviceDiagnosisStateDataType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.DeviceDiagnosisStateDataType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeviceDiagnosisCommonInterface_GetState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetState'
type DeviceDiagnosisCommonInterface_GetState_Call struct {
*mock.Call
}
// GetState is a helper method to define mock.On call
func (_e *DeviceDiagnosisCommonInterface_Expecter) GetState() *DeviceDiagnosisCommonInterface_GetState_Call {
return &DeviceDiagnosisCommonInterface_GetState_Call{Call: _e.mock.On("GetState")}
}
func (_c *DeviceDiagnosisCommonInterface_GetState_Call) Run(run func()) *DeviceDiagnosisCommonInterface_GetState_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *DeviceDiagnosisCommonInterface_GetState_Call) Return(_a0 *model.DeviceDiagnosisStateDataType, _a1 error) *DeviceDiagnosisCommonInterface_GetState_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *DeviceDiagnosisCommonInterface_GetState_Call) RunAndReturn(run func() (*model.DeviceDiagnosisStateDataType, error)) *DeviceDiagnosisCommonInterface_GetState_Call {
_c.Call.Return(run)
return _c
}
// 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 rf, ok := ret.Get(0).(func(time.Duration) bool); ok {
r0 = rf(duration)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsHeartbeatWithinDuration'
type DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call struct {
*mock.Call
}
// IsHeartbeatWithinDuration is a helper method to define mock.On call
// - duration time.Duration
func (_e *DeviceDiagnosisCommonInterface_Expecter) IsHeartbeatWithinDuration(duration interface{}) *DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call {
return &DeviceDiagnosisCommonInterface_IsHeartbeatWithinDuration_Call{Call: _e.mock.On("IsHeartbeatWithinDuration", duration)}
}
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))
})
return _c
}
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(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
}
@@ -0,0 +1,68 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// DeviceDiagnosisServerInterface is an autogenerated mock type for the DeviceDiagnosisServerInterface type
type DeviceDiagnosisServerInterface struct {
mock.Mock
}
type DeviceDiagnosisServerInterface_Expecter struct {
mock *mock.Mock
}
func (_m *DeviceDiagnosisServerInterface) EXPECT() *DeviceDiagnosisServerInterface_Expecter {
return &DeviceDiagnosisServerInterface_Expecter{mock: &_m.Mock}
}
// SetLocalState provides a mock function with given fields: operatingState
func (_m *DeviceDiagnosisServerInterface) SetLocalState(operatingState *model.DeviceDiagnosisStateDataType) {
_m.Called(operatingState)
}
// DeviceDiagnosisServerInterface_SetLocalState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetLocalState'
type DeviceDiagnosisServerInterface_SetLocalState_Call struct {
*mock.Call
}
// SetLocalState is a helper method to define mock.On call
// - operatingState *model.DeviceDiagnosisStateDataType
func (_e *DeviceDiagnosisServerInterface_Expecter) SetLocalState(operatingState interface{}) *DeviceDiagnosisServerInterface_SetLocalState_Call {
return &DeviceDiagnosisServerInterface_SetLocalState_Call{Call: _e.mock.On("SetLocalState", operatingState)}
}
func (_c *DeviceDiagnosisServerInterface_SetLocalState_Call) Run(run func(operatingState *model.DeviceDiagnosisStateDataType)) *DeviceDiagnosisServerInterface_SetLocalState_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.DeviceDiagnosisStateDataType))
})
return _c
}
func (_c *DeviceDiagnosisServerInterface_SetLocalState_Call) Return() *DeviceDiagnosisServerInterface_SetLocalState_Call {
_c.Call.Return()
return _c
}
func (_c *DeviceDiagnosisServerInterface_SetLocalState_Call) RunAndReturn(run func(*model.DeviceDiagnosisStateDataType)) *DeviceDiagnosisServerInterface_SetLocalState_Call {
_c.Call.Return(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
}
@@ -0,0 +1,271 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// ElectricalConnectionClientInterface is an autogenerated mock type for the ElectricalConnectionClientInterface type
type ElectricalConnectionClientInterface struct {
mock.Mock
}
type ElectricalConnectionClientInterface_Expecter struct {
mock *mock.Mock
}
func (_m *ElectricalConnectionClientInterface) EXPECT() *ElectricalConnectionClientInterface_Expecter {
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)
if len(ret) == 0 {
panic("no return value specified for RequestCharacteristics")
}
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 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 rf, ok := ret.Get(1).(func(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *model.ElectricalConnectionCharacteristicDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionClientInterface_RequestCharacteristics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestCharacteristics'
type ElectricalConnectionClientInterface_RequestCharacteristics_Call struct {
*mock.Call
}
// RequestCharacteristics is a helper method to define mock.On call
// - selector *model.ElectricalConnectionCharacteristicListDataSelectorsType
// - elements *model.ElectricalConnectionCharacteristicDataElementsType
func (_e *ElectricalConnectionClientInterface_Expecter) RequestCharacteristics(selector interface{}, elements interface{}) *ElectricalConnectionClientInterface_RequestCharacteristics_Call {
return &ElectricalConnectionClientInterface_RequestCharacteristics_Call{Call: _e.mock.On("RequestCharacteristics", selector, elements)}
}
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))
})
return _c
}
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(*model.ElectricalConnectionCharacteristicListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for RequestDescriptions")
}
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 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 rf, ok := ret.Get(1).(func(*model.ElectricalConnectionDescriptionListDataSelectorsType, *model.ElectricalConnectionDescriptionDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionClientInterface_RequestDescriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestDescriptions'
type ElectricalConnectionClientInterface_RequestDescriptions_Call struct {
*mock.Call
}
// RequestDescriptions is a helper method to define mock.On call
// - selector *model.ElectricalConnectionDescriptionListDataSelectorsType
// - elements *model.ElectricalConnectionDescriptionDataElementsType
func (_e *ElectricalConnectionClientInterface_Expecter) RequestDescriptions(selector interface{}, elements interface{}) *ElectricalConnectionClientInterface_RequestDescriptions_Call {
return &ElectricalConnectionClientInterface_RequestDescriptions_Call{Call: _e.mock.On("RequestDescriptions", selector, elements)}
}
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))
})
return _c
}
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(*model.ElectricalConnectionDescriptionListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for RequestParameterDescriptions")
}
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 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 rf, ok := ret.Get(1).(func(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *model.ElectricalConnectionParameterDescriptionDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionClientInterface_RequestParameterDescriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestParameterDescriptions'
type ElectricalConnectionClientInterface_RequestParameterDescriptions_Call struct {
*mock.Call
}
// RequestParameterDescriptions is a helper method to define mock.On call
// - selector *model.ElectricalConnectionParameterDescriptionListDataSelectorsType
// - elements *model.ElectricalConnectionParameterDescriptionDataElementsType
func (_e *ElectricalConnectionClientInterface_Expecter) RequestParameterDescriptions(selector interface{}, elements interface{}) *ElectricalConnectionClientInterface_RequestParameterDescriptions_Call {
return &ElectricalConnectionClientInterface_RequestParameterDescriptions_Call{Call: _e.mock.On("RequestParameterDescriptions", selector, elements)}
}
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))
})
return _c
}
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(*model.ElectricalConnectionParameterDescriptionListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for RequestPermittedValueSets")
}
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 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 rf, ok := ret.Get(1).(func(*model.ElectricalConnectionPermittedValueSetListDataSelectorsType, *model.ElectricalConnectionPermittedValueSetDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionClientInterface_RequestPermittedValueSets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestPermittedValueSets'
type ElectricalConnectionClientInterface_RequestPermittedValueSets_Call struct {
*mock.Call
}
// RequestPermittedValueSets is a helper method to define mock.On call
// - selector *model.ElectricalConnectionPermittedValueSetListDataSelectorsType
// - elements *model.ElectricalConnectionPermittedValueSetDataElementsType
func (_e *ElectricalConnectionClientInterface_Expecter) RequestPermittedValueSets(selector interface{}, elements interface{}) *ElectricalConnectionClientInterface_RequestPermittedValueSets_Call {
return &ElectricalConnectionClientInterface_RequestPermittedValueSets_Call{Call: _e.mock.On("RequestPermittedValueSets", selector, elements)}
}
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))
})
return _c
}
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(*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
}
@@ -0,0 +1,565 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// ElectricalConnectionCommonInterface is an autogenerated mock type for the ElectricalConnectionCommonInterface type
type ElectricalConnectionCommonInterface struct {
mock.Mock
}
type ElectricalConnectionCommonInterface_Expecter struct {
mock *mock.Mock
}
func (_m *ElectricalConnectionCommonInterface) EXPECT() *ElectricalConnectionCommonInterface_Expecter {
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)
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)
} else {
r0 = ret.Get(0).(float64)
}
return r0
}
// ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AdjustValueToBeWithinPermittedValuesForParameterId'
type ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call struct {
*mock.Call
}
// AdjustValueToBeWithinPermittedValuesForParameterId is a helper method to define mock.On call
// - value float64
// - parameterId model.ElectricalConnectionParameterIdType
func (_e *ElectricalConnectionCommonInterface_Expecter) AdjustValueToBeWithinPermittedValuesForParameterId(value interface{}, parameterId interface{}) *ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call {
return &ElectricalConnectionCommonInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call{Call: _e.mock.On("AdjustValueToBeWithinPermittedValuesForParameterId", value, parameterId)}
}
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))
})
return _c
}
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(float64, 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)
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)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckEventPayloadDataForFilter'
type ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call struct {
*mock.Call
}
// CheckEventPayloadDataForFilter is a helper method to define mock.On call
// - 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 interface{}, filter interface{})) *ElectricalConnectionCommonInterface_CheckEventPayloadDataForFilter_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(interface{}), args[1].(interface{}))
})
return _c
}
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(interface{}, interface{}) 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)
if len(ret) == 0 {
panic("no return value specified for GetCharacteristicsForFilter")
}
var r0 []model.ElectricalConnectionCharacteristicDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCharacteristicsForFilter'
type ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call struct {
*mock.Call
}
// GetCharacteristicsForFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionCharacteristicDataType
func (_e *ElectricalConnectionCommonInterface_Expecter) GetCharacteristicsForFilter(filter interface{}) *ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call {
return &ElectricalConnectionCommonInterface_GetCharacteristicsForFilter_Call{Call: _e.mock.On("GetCharacteristicsForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetDescriptionForParameterDescriptionFilter")
}
var r0 *model.ElectricalConnectionDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDescriptionForParameterDescriptionFilter'
type ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call struct {
*mock.Call
}
// GetDescriptionForParameterDescriptionFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionParameterDescriptionDataType
func (_e *ElectricalConnectionCommonInterface_Expecter) GetDescriptionForParameterDescriptionFilter(filter interface{}) *ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call {
return &ElectricalConnectionCommonInterface_GetDescriptionForParameterDescriptionFilter_Call{Call: _e.mock.On("GetDescriptionForParameterDescriptionFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetDescriptionsForFilter")
}
var r0 []model.ElectricalConnectionDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDescriptionsForFilter'
type ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call struct {
*mock.Call
}
// GetDescriptionsForFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionDescriptionDataType
func (_e *ElectricalConnectionCommonInterface_Expecter) GetDescriptionsForFilter(filter interface{}) *ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call {
return &ElectricalConnectionCommonInterface_GetDescriptionsForFilter_Call{Call: _e.mock.On("GetDescriptionsForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for 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 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 rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetParameterDescriptionsForFilter'
type ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call struct {
*mock.Call
}
// GetParameterDescriptionsForFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionParameterDescriptionDataType
func (_e *ElectricalConnectionCommonInterface_Expecter) GetParameterDescriptionsForFilter(filter interface{}) *ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call {
return &ElectricalConnectionCommonInterface_GetParameterDescriptionsForFilter_Call{Call: _e.mock.On("GetParameterDescriptionsForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetPermittedValueDataForFilter")
}
var r0 float64
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 rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok {
r0 = rf(filter)
} else {
r0 = ret.Get(0).(float64)
}
if rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok {
r1 = rf(filter)
} else {
r1 = ret.Get(1).(float64)
}
if rf, ok := ret.Get(2).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok {
r2 = rf(filter)
} else {
r2 = ret.Get(2).(float64)
}
if rf, ok := ret.Get(3).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok {
r3 = rf(filter)
} else {
r3 = ret.Error(3)
}
return r0, r1, r2, r3
}
// ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPermittedValueDataForFilter'
type ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call struct {
*mock.Call
}
// GetPermittedValueDataForFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionPermittedValueSetDataType
func (_e *ElectricalConnectionCommonInterface_Expecter) GetPermittedValueDataForFilter(filter interface{}) *ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call {
return &ElectricalConnectionCommonInterface_GetPermittedValueDataForFilter_Call{Call: _e.mock.On("GetPermittedValueDataForFilter", filter)}
}
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))
})
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)
return _c
}
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 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")
}
var r0 []model.ElectricalConnectionPermittedValueSetDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPermittedValueSetForFilter'
type ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call struct {
*mock.Call
}
// GetPermittedValueSetForFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionPermittedValueSetDataType
func (_e *ElectricalConnectionCommonInterface_Expecter) GetPermittedValueSetForFilter(filter interface{}) *ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call {
return &ElectricalConnectionCommonInterface_GetPermittedValueSetForFilter_Call{Call: _e.mock.On("GetPermittedValueSetForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetPhaseCurrentLimits")
}
var r0 []float64
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 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 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 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 rf, ok := ret.Get(3).(func([]model.MeasurementDescriptionDataType) error); ok {
r3 = rf(measDesc)
} else {
r3 = ret.Error(3)
}
return r0, r1, r2, r3
}
// ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPhaseCurrentLimits'
type ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call struct {
*mock.Call
}
// GetPhaseCurrentLimits is a helper method to define mock.On call
// - measDesc []model.MeasurementDescriptionDataType
func (_e *ElectricalConnectionCommonInterface_Expecter) GetPhaseCurrentLimits(measDesc interface{}) *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call {
return &ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call{Call: _e.mock.On("GetPhaseCurrentLimits", measDesc)}
}
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))
})
return _c
}
func (_c *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call) Return(resultMin []float64, resultMax []float64, resultDefault []float64, resultErr error) *ElectricalConnectionCommonInterface_GetPhaseCurrentLimits_Call {
_c.Call.Return(resultMin, resultMax, resultDefault, resultErr)
return _c
}
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
}
@@ -0,0 +1,764 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// ElectricalConnectionServerInterface is an autogenerated mock type for the ElectricalConnectionServerInterface type
type ElectricalConnectionServerInterface struct {
mock.Mock
}
type ElectricalConnectionServerInterface_Expecter struct {
mock *mock.Mock
}
func (_m *ElectricalConnectionServerInterface) EXPECT() *ElectricalConnectionServerInterface_Expecter {
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)
if len(ret) == 0 {
panic("no return value specified for AddCharacteristic")
}
var r0 *model.ElectricalConnectionCharacteristicIdType
var r1 error
if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) (*model.ElectricalConnectionCharacteristicIdType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok {
r1 = rf(data)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionServerInterface_AddCharacteristic_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddCharacteristic'
type ElectricalConnectionServerInterface_AddCharacteristic_Call struct {
*mock.Call
}
// AddCharacteristic is a helper method to define mock.On call
// - data model.ElectricalConnectionCharacteristicDataType
func (_e *ElectricalConnectionServerInterface_Expecter) AddCharacteristic(data interface{}) *ElectricalConnectionServerInterface_AddCharacteristic_Call {
return &ElectricalConnectionServerInterface_AddCharacteristic_Call{Call: _e.mock.On("AddCharacteristic", data)}
}
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))
})
return _c
}
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(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)
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)
} else {
r0 = ret.Error(0)
}
return r0
}
// ElectricalConnectionServerInterface_AddDescription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddDescription'
type ElectricalConnectionServerInterface_AddDescription_Call struct {
*mock.Call
}
// AddDescription is a helper method to define mock.On call
// - description model.ElectricalConnectionDescriptionDataType
func (_e *ElectricalConnectionServerInterface_Expecter) AddDescription(description interface{}) *ElectricalConnectionServerInterface_AddDescription_Call {
return &ElectricalConnectionServerInterface_AddDescription_Call{Call: _e.mock.On("AddDescription", description)}
}
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))
})
return _c
}
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(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)
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)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.ElectricalConnectionParameterIdType)
}
}
return r0
}
// ElectricalConnectionServerInterface_AddParameterDescription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddParameterDescription'
type ElectricalConnectionServerInterface_AddParameterDescription_Call struct {
*mock.Call
}
// AddParameterDescription is a helper method to define mock.On call
// - description model.ElectricalConnectionParameterDescriptionDataType
func (_e *ElectricalConnectionServerInterface_Expecter) AddParameterDescription(description interface{}) *ElectricalConnectionServerInterface_AddParameterDescription_Call {
return &ElectricalConnectionServerInterface_AddParameterDescription_Call{Call: _e.mock.On("AddParameterDescription", description)}
}
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))
})
return _c
}
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(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)
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)
} else {
r0 = ret.Get(0).(float64)
}
return r0
}
// ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AdjustValueToBeWithinPermittedValuesForParameterId'
type ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call struct {
*mock.Call
}
// AdjustValueToBeWithinPermittedValuesForParameterId is a helper method to define mock.On call
// - value float64
// - parameterId model.ElectricalConnectionParameterIdType
func (_e *ElectricalConnectionServerInterface_Expecter) AdjustValueToBeWithinPermittedValuesForParameterId(value interface{}, parameterId interface{}) *ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call {
return &ElectricalConnectionServerInterface_AdjustValueToBeWithinPermittedValuesForParameterId_Call{Call: _e.mock.On("AdjustValueToBeWithinPermittedValuesForParameterId", value, parameterId)}
}
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))
})
return _c
}
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(float64, 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)
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)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckEventPayloadDataForFilter'
type ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call struct {
*mock.Call
}
// CheckEventPayloadDataForFilter is a helper method to define mock.On call
// - 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 interface{}, filter interface{})) *ElectricalConnectionServerInterface_CheckEventPayloadDataForFilter_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(interface{}), args[1].(interface{}))
})
return _c
}
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(interface{}, interface{}) 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)
if len(ret) == 0 {
panic("no return value specified for GetCharacteristicsForFilter")
}
var r0 []model.ElectricalConnectionCharacteristicDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType) ([]model.ElectricalConnectionCharacteristicDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.ElectricalConnectionCharacteristicDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCharacteristicsForFilter'
type ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call struct {
*mock.Call
}
// GetCharacteristicsForFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionCharacteristicDataType
func (_e *ElectricalConnectionServerInterface_Expecter) GetCharacteristicsForFilter(filter interface{}) *ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call {
return &ElectricalConnectionServerInterface_GetCharacteristicsForFilter_Call{Call: _e.mock.On("GetCharacteristicsForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetDescriptionForParameterDescriptionFilter")
}
var r0 *model.ElectricalConnectionDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) (*model.ElectricalConnectionDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDescriptionForParameterDescriptionFilter'
type ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call struct {
*mock.Call
}
// GetDescriptionForParameterDescriptionFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionParameterDescriptionDataType
func (_e *ElectricalConnectionServerInterface_Expecter) GetDescriptionForParameterDescriptionFilter(filter interface{}) *ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call {
return &ElectricalConnectionServerInterface_GetDescriptionForParameterDescriptionFilter_Call{Call: _e.mock.On("GetDescriptionForParameterDescriptionFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetDescriptionsForFilter")
}
var r0 []model.ElectricalConnectionDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.ElectricalConnectionDescriptionDataType) ([]model.ElectricalConnectionDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.ElectricalConnectionDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDescriptionsForFilter'
type ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call struct {
*mock.Call
}
// GetDescriptionsForFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionDescriptionDataType
func (_e *ElectricalConnectionServerInterface_Expecter) GetDescriptionsForFilter(filter interface{}) *ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call {
return &ElectricalConnectionServerInterface_GetDescriptionsForFilter_Call{Call: _e.mock.On("GetDescriptionsForFilter", filter)}
}
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))
})
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
}
// 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")
}
var r0 []model.ElectricalConnectionParameterDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.ElectricalConnectionParameterDescriptionDataType) ([]model.ElectricalConnectionParameterDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.ElectricalConnectionParameterDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetParameterDescriptionsForFilter'
type ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call struct {
*mock.Call
}
// GetParameterDescriptionsForFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionParameterDescriptionDataType
func (_e *ElectricalConnectionServerInterface_Expecter) GetParameterDescriptionsForFilter(filter interface{}) *ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call {
return &ElectricalConnectionServerInterface_GetParameterDescriptionsForFilter_Call{Call: _e.mock.On("GetParameterDescriptionsForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetPermittedValueDataForFilter")
}
var r0 float64
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 rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok {
r0 = rf(filter)
} else {
r0 = ret.Get(0).(float64)
}
if rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok {
r1 = rf(filter)
} else {
r1 = ret.Get(1).(float64)
}
if rf, ok := ret.Get(2).(func(model.ElectricalConnectionPermittedValueSetDataType) float64); ok {
r2 = rf(filter)
} else {
r2 = ret.Get(2).(float64)
}
if rf, ok := ret.Get(3).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok {
r3 = rf(filter)
} else {
r3 = ret.Error(3)
}
return r0, r1, r2, r3
}
// ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPermittedValueDataForFilter'
type ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call struct {
*mock.Call
}
// GetPermittedValueDataForFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionPermittedValueSetDataType
func (_e *ElectricalConnectionServerInterface_Expecter) GetPermittedValueDataForFilter(filter interface{}) *ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call {
return &ElectricalConnectionServerInterface_GetPermittedValueDataForFilter_Call{Call: _e.mock.On("GetPermittedValueDataForFilter", filter)}
}
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))
})
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)
return _c
}
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 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")
}
var r0 []model.ElectricalConnectionPermittedValueSetDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.ElectricalConnectionPermittedValueSetDataType) ([]model.ElectricalConnectionPermittedValueSetDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.ElectricalConnectionPermittedValueSetDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPermittedValueSetForFilter'
type ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call struct {
*mock.Call
}
// GetPermittedValueSetForFilter is a helper method to define mock.On call
// - filter model.ElectricalConnectionPermittedValueSetDataType
func (_e *ElectricalConnectionServerInterface_Expecter) GetPermittedValueSetForFilter(filter interface{}) *ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call {
return &ElectricalConnectionServerInterface_GetPermittedValueSetForFilter_Call{Call: _e.mock.On("GetPermittedValueSetForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetPhaseCurrentLimits")
}
var r0 []float64
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 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 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 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 rf, ok := ret.Get(3).(func([]model.MeasurementDescriptionDataType) error); ok {
r3 = rf(measDesc)
} else {
r3 = ret.Error(3)
}
return r0, r1, r2, r3
}
// ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPhaseCurrentLimits'
type ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call struct {
*mock.Call
}
// GetPhaseCurrentLimits is a helper method to define mock.On call
// - measDesc []model.MeasurementDescriptionDataType
func (_e *ElectricalConnectionServerInterface_Expecter) GetPhaseCurrentLimits(measDesc interface{}) *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call {
return &ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call{Call: _e.mock.On("GetPhaseCurrentLimits", measDesc)}
}
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))
})
return _c
}
func (_c *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call) Return(resultMin []float64, resultMax []float64, resultDefault []float64, resultErr error) *ElectricalConnectionServerInterface_GetPhaseCurrentLimits_Call {
_c.Call.Return(resultMin, resultMax, resultDefault, resultErr)
return _c
}
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 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 rf, ok := ret.Get(0).(func(model.ElectricalConnectionCharacteristicDataType, *model.ElectricalConnectionCharacteristicDataElementsType) error); ok {
r0 = rf(data, deleteElements)
} else {
r0 = ret.Error(0)
}
return r0
}
// ElectricalConnectionServerInterface_UpdateCharacteristic_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCharacteristic'
type ElectricalConnectionServerInterface_UpdateCharacteristic_Call struct {
*mock.Call
}
// UpdateCharacteristic is a helper method to define mock.On call
// - data model.ElectricalConnectionCharacteristicDataType
// - deleteElements *model.ElectricalConnectionCharacteristicDataElementsType
func (_e *ElectricalConnectionServerInterface_Expecter) UpdateCharacteristic(data interface{}, deleteElements interface{}) *ElectricalConnectionServerInterface_UpdateCharacteristic_Call {
return &ElectricalConnectionServerInterface_UpdateCharacteristic_Call{Call: _e.mock.On("UpdateCharacteristic", data, deleteElements)}
}
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))
})
return _c
}
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(model.ElectricalConnectionCharacteristicDataType, *model.ElectricalConnectionCharacteristicDataElementsType) error) *ElectricalConnectionServerInterface_UpdateCharacteristic_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
}
@@ -0,0 +1,73 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
eebus_goapi "github.com/enbility/eebus-go/api"
api "github.com/enbility/spine-go/api"
mock "github.com/stretchr/testify/mock"
)
// EntityEventCallback is an autogenerated mock type for the EntityEventCallback type
type EntityEventCallback struct {
mock.Mock
}
type EntityEventCallback_Expecter struct {
mock *mock.Mock
}
func (_m *EntityEventCallback) EXPECT() *EntityEventCallback_Expecter {
return &EntityEventCallback_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: ski, device, entity, event
func (_m *EntityEventCallback) Execute(ski string, device api.DeviceRemoteInterface, entity api.EntityRemoteInterface, event eebus_goapi.EventType) {
_m.Called(ski, device, entity, event)
}
// EntityEventCallback_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type EntityEventCallback_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - ski string
// - device api.DeviceRemoteInterface
// - entity api.EntityRemoteInterface
// - event eebus_goapi.EventType
func (_e *EntityEventCallback_Expecter) Execute(ski interface{}, device interface{}, entity interface{}, event interface{}) *EntityEventCallback_Execute_Call {
return &EntityEventCallback_Execute_Call{Call: _e.mock.On("Execute", ski, device, entity, event)}
}
func (_c *EntityEventCallback_Execute_Call) Run(run func(ski string, device api.DeviceRemoteInterface, entity api.EntityRemoteInterface, event eebus_goapi.EventType)) *EntityEventCallback_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(api.DeviceRemoteInterface), args[2].(api.EntityRemoteInterface), args[3].(eebus_goapi.EventType))
})
return _c
}
func (_c *EntityEventCallback_Execute_Call) Return() *EntityEventCallback_Execute_Call {
_c.Call.Return()
return _c
}
func (_c *EntityEventCallback_Execute_Call) RunAndReturn(run func(string, api.DeviceRemoteInterface, api.EntityRemoteInterface, eebus_goapi.EventType)) *EntityEventCallback_Execute_Call {
_c.Call.Return(run)
return _c
}
// NewEntityEventCallback creates a new instance of EntityEventCallback. 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 NewEntityEventCallback(t interface {
mock.TestingT
Cleanup(func())
}) *EntityEventCallback {
mock := &EntityEventCallback{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,322 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
api "github.com/enbility/spine-go/api"
mock "github.com/stretchr/testify/mock"
model "github.com/enbility/spine-go/model"
)
// FeatureClientInterface is an autogenerated mock type for the FeatureClientInterface type
type FeatureClientInterface struct {
mock.Mock
}
type FeatureClientInterface_Expecter struct {
mock *mock.Mock
}
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)
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)
} else {
r0 = ret.Error(0)
}
return r0
}
// FeatureClientInterface_AddResponseCallback_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddResponseCallback'
type FeatureClientInterface_AddResponseCallback_Call struct {
*mock.Call
}
// AddResponseCallback is a helper method to define mock.On call
// - msgCounterReference model.MsgCounterType
// - 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(api.ResponseMessage))) *FeatureClientInterface_AddResponseCallback_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(model.MsgCounterType), args[1].(func(api.ResponseMessage)))
})
return _c
}
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(model.MsgCounterType, func(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)
}
// FeatureClientInterface_AddResultCallback_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddResultCallback'
type FeatureClientInterface_AddResultCallback_Call struct {
*mock.Call
}
// AddResultCallback is a helper method to define mock.On call
// - 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(api.ResponseMessage))) *FeatureClientInterface_AddResultCallback_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(func(api.ResponseMessage)))
})
return _c
}
func (_c *FeatureClientInterface_AddResultCallback_Call) Return() *FeatureClientInterface_AddResultCallback_Call {
_c.Call.Return()
return _c
}
func (_c *FeatureClientInterface_AddResultCallback_Call) RunAndReturn(run func(func(api.ResponseMessage))) *FeatureClientInterface_AddResultCallback_Call {
_c.Call.Return(run)
return _c
}
// Bind provides a mock function with given fields:
func (_m *FeatureClientInterface) Bind() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Bind")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FeatureClientInterface_Bind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Bind'
type FeatureClientInterface_Bind_Call struct {
*mock.Call
}
// Bind is a helper method to define mock.On call
func (_e *FeatureClientInterface_Expecter) Bind() *FeatureClientInterface_Bind_Call {
return &FeatureClientInterface_Bind_Call{Call: _e.mock.On("Bind")}
}
func (_c *FeatureClientInterface_Bind_Call) Run(run func()) *FeatureClientInterface_Bind_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *FeatureClientInterface_Bind_Call) Return(_a0 *model.MsgCounterType, _a1 error) *FeatureClientInterface_Bind_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *FeatureClientInterface_Bind_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *FeatureClientInterface_Bind_Call {
_c.Call.Return(run)
return _c
}
// HasBinding provides a mock function with given fields:
func (_m *FeatureClientInterface) HasBinding() bool {
ret := _m.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()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// FeatureClientInterface_HasBinding_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasBinding'
type FeatureClientInterface_HasBinding_Call struct {
*mock.Call
}
// HasBinding is a helper method to define mock.On call
func (_e *FeatureClientInterface_Expecter) HasBinding() *FeatureClientInterface_HasBinding_Call {
return &FeatureClientInterface_HasBinding_Call{Call: _e.mock.On("HasBinding")}
}
func (_c *FeatureClientInterface_HasBinding_Call) Run(run func()) *FeatureClientInterface_HasBinding_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *FeatureClientInterface_HasBinding_Call) Return(_a0 bool) *FeatureClientInterface_HasBinding_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *FeatureClientInterface_HasBinding_Call) RunAndReturn(run func() bool) *FeatureClientInterface_HasBinding_Call {
_c.Call.Return(run)
return _c
}
// HasSubscription provides a mock function with given fields:
func (_m *FeatureClientInterface) HasSubscription() bool {
ret := _m.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()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// FeatureClientInterface_HasSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasSubscription'
type FeatureClientInterface_HasSubscription_Call struct {
*mock.Call
}
// HasSubscription is a helper method to define mock.On call
func (_e *FeatureClientInterface_Expecter) HasSubscription() *FeatureClientInterface_HasSubscription_Call {
return &FeatureClientInterface_HasSubscription_Call{Call: _e.mock.On("HasSubscription")}
}
func (_c *FeatureClientInterface_HasSubscription_Call) Run(run func()) *FeatureClientInterface_HasSubscription_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *FeatureClientInterface_HasSubscription_Call) Return(_a0 bool) *FeatureClientInterface_HasSubscription_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *FeatureClientInterface_HasSubscription_Call) RunAndReturn(run func() bool) *FeatureClientInterface_HasSubscription_Call {
_c.Call.Return(run)
return _c
}
// Subscribe provides a mock function with given fields:
func (_m *FeatureClientInterface) Subscribe() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Subscribe")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FeatureClientInterface_Subscribe_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Subscribe'
type FeatureClientInterface_Subscribe_Call struct {
*mock.Call
}
// Subscribe is a helper method to define mock.On call
func (_e *FeatureClientInterface_Expecter) Subscribe() *FeatureClientInterface_Subscribe_Call {
return &FeatureClientInterface_Subscribe_Call{Call: _e.mock.On("Subscribe")}
}
func (_c *FeatureClientInterface_Subscribe_Call) Run(run func()) *FeatureClientInterface_Subscribe_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *FeatureClientInterface_Subscribe_Call) Return(_a0 *model.MsgCounterType, _a1 error) *FeatureClientInterface_Subscribe_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *FeatureClientInterface_Subscribe_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *FeatureClientInterface_Subscribe_Call {
_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
}
@@ -0,0 +1,322 @@
// Code generated by mockery v2.42.1. DO NOT EDIT.
package mocks
import (
api "github.com/enbility/spine-go/api"
mock "github.com/stretchr/testify/mock"
model "github.com/enbility/spine-go/model"
)
// FeatureInterface is an autogenerated mock type for the FeatureInterface type
type FeatureInterface struct {
mock.Mock
}
type FeatureInterface_Expecter struct {
mock *mock.Mock
}
func (_m *FeatureInterface) EXPECT() *FeatureInterface_Expecter {
return &FeatureInterface_Expecter{mock: &_m.Mock}
}
// AddResponseCallback provides a mock function with given fields: msgCounterReference, function
func (_m *FeatureInterface) 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 rf, ok := ret.Get(0).(func(model.MsgCounterType, func(api.ResponseMessage)) error); ok {
r0 = rf(msgCounterReference, function)
} else {
r0 = ret.Error(0)
}
return r0
}
// FeatureInterface_AddResponseCallback_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddResponseCallback'
type FeatureInterface_AddResponseCallback_Call struct {
*mock.Call
}
// AddResponseCallback is a helper method to define mock.On call
// - msgCounterReference model.MsgCounterType
// - function func(api.ResponseMessage)
func (_e *FeatureInterface_Expecter) AddResponseCallback(msgCounterReference interface{}, function interface{}) *FeatureInterface_AddResponseCallback_Call {
return &FeatureInterface_AddResponseCallback_Call{Call: _e.mock.On("AddResponseCallback", msgCounterReference, function)}
}
func (_c *FeatureInterface_AddResponseCallback_Call) Run(run func(msgCounterReference model.MsgCounterType, function func(api.ResponseMessage))) *FeatureInterface_AddResponseCallback_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(model.MsgCounterType), args[1].(func(api.ResponseMessage)))
})
return _c
}
func (_c *FeatureInterface_AddResponseCallback_Call) Return(_a0 error) *FeatureInterface_AddResponseCallback_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *FeatureInterface_AddResponseCallback_Call) RunAndReturn(run func(model.MsgCounterType, func(api.ResponseMessage)) error) *FeatureInterface_AddResponseCallback_Call {
_c.Call.Return(run)
return _c
}
// AddResultCallback provides a mock function with given fields: function
func (_m *FeatureInterface) AddResultCallback(function func(api.ResponseMessage)) {
_m.Called(function)
}
// FeatureInterface_AddResultCallback_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddResultCallback'
type FeatureInterface_AddResultCallback_Call struct {
*mock.Call
}
// AddResultCallback is a helper method to define mock.On call
// - function func(api.ResponseMessage)
func (_e *FeatureInterface_Expecter) AddResultCallback(function interface{}) *FeatureInterface_AddResultCallback_Call {
return &FeatureInterface_AddResultCallback_Call{Call: _e.mock.On("AddResultCallback", function)}
}
func (_c *FeatureInterface_AddResultCallback_Call) Run(run func(function func(api.ResponseMessage))) *FeatureInterface_AddResultCallback_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(func(api.ResponseMessage)))
})
return _c
}
func (_c *FeatureInterface_AddResultCallback_Call) Return() *FeatureInterface_AddResultCallback_Call {
_c.Call.Return()
return _c
}
func (_c *FeatureInterface_AddResultCallback_Call) RunAndReturn(run func(func(api.ResponseMessage))) *FeatureInterface_AddResultCallback_Call {
_c.Call.Return(run)
return _c
}
// Bind provides a mock function with given fields:
func (_m *FeatureInterface) Bind() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Bind")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FeatureInterface_Bind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Bind'
type FeatureInterface_Bind_Call struct {
*mock.Call
}
// Bind is a helper method to define mock.On call
func (_e *FeatureInterface_Expecter) Bind() *FeatureInterface_Bind_Call {
return &FeatureInterface_Bind_Call{Call: _e.mock.On("Bind")}
}
func (_c *FeatureInterface_Bind_Call) Run(run func()) *FeatureInterface_Bind_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *FeatureInterface_Bind_Call) Return(_a0 *model.MsgCounterType, _a1 error) *FeatureInterface_Bind_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *FeatureInterface_Bind_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *FeatureInterface_Bind_Call {
_c.Call.Return(run)
return _c
}
// HasBinding provides a mock function with given fields:
func (_m *FeatureInterface) HasBinding() bool {
ret := _m.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()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// FeatureInterface_HasBinding_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasBinding'
type FeatureInterface_HasBinding_Call struct {
*mock.Call
}
// HasBinding is a helper method to define mock.On call
func (_e *FeatureInterface_Expecter) HasBinding() *FeatureInterface_HasBinding_Call {
return &FeatureInterface_HasBinding_Call{Call: _e.mock.On("HasBinding")}
}
func (_c *FeatureInterface_HasBinding_Call) Run(run func()) *FeatureInterface_HasBinding_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *FeatureInterface_HasBinding_Call) Return(_a0 bool) *FeatureInterface_HasBinding_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *FeatureInterface_HasBinding_Call) RunAndReturn(run func() bool) *FeatureInterface_HasBinding_Call {
_c.Call.Return(run)
return _c
}
// HasSubscription provides a mock function with given fields:
func (_m *FeatureInterface) HasSubscription() bool {
ret := _m.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()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// FeatureInterface_HasSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasSubscription'
type FeatureInterface_HasSubscription_Call struct {
*mock.Call
}
// HasSubscription is a helper method to define mock.On call
func (_e *FeatureInterface_Expecter) HasSubscription() *FeatureInterface_HasSubscription_Call {
return &FeatureInterface_HasSubscription_Call{Call: _e.mock.On("HasSubscription")}
}
func (_c *FeatureInterface_HasSubscription_Call) Run(run func()) *FeatureInterface_HasSubscription_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *FeatureInterface_HasSubscription_Call) Return(_a0 bool) *FeatureInterface_HasSubscription_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *FeatureInterface_HasSubscription_Call) RunAndReturn(run func() bool) *FeatureInterface_HasSubscription_Call {
_c.Call.Return(run)
return _c
}
// Subscribe provides a mock function with given fields:
func (_m *FeatureInterface) Subscribe() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Subscribe")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FeatureInterface_Subscribe_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Subscribe'
type FeatureInterface_Subscribe_Call struct {
*mock.Call
}
// Subscribe is a helper method to define mock.On call
func (_e *FeatureInterface_Expecter) Subscribe() *FeatureInterface_Subscribe_Call {
return &FeatureInterface_Subscribe_Call{Call: _e.mock.On("Subscribe")}
}
func (_c *FeatureInterface_Subscribe_Call) Run(run func()) *FeatureInterface_Subscribe_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *FeatureInterface_Subscribe_Call) Return(_a0 *model.MsgCounterType, _a1 error) *FeatureInterface_Subscribe_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *FeatureInterface_Subscribe_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *FeatureInterface_Subscribe_Call {
_c.Call.Return(run)
return _c
}
// NewFeatureInterface creates a new instance of FeatureInterface. 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 NewFeatureInterface(t interface {
mock.TestingT
Cleanup(func())
}) *FeatureInterface {
mock := &FeatureInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,32 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
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}
}
// 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.
func NewFeatureServerInterface(t interface {
mock.TestingT
Cleanup(func())
}) *FeatureServerInterface {
mock := &FeatureServerInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,92 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// IdentificationClientInterface is an autogenerated mock type for the IdentificationClientInterface type
type IdentificationClientInterface struct {
mock.Mock
}
type IdentificationClientInterface_Expecter struct {
mock *mock.Mock
}
func (_m *IdentificationClientInterface) EXPECT() *IdentificationClientInterface_Expecter {
return &IdentificationClientInterface_Expecter{mock: &_m.Mock}
}
// RequestValues provides a mock function with given fields:
func (_m *IdentificationClientInterface) RequestValues() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RequestValues")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IdentificationClientInterface_RequestValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestValues'
type IdentificationClientInterface_RequestValues_Call struct {
*mock.Call
}
// RequestValues is a helper method to define mock.On call
func (_e *IdentificationClientInterface_Expecter) RequestValues() *IdentificationClientInterface_RequestValues_Call {
return &IdentificationClientInterface_RequestValues_Call{Call: _e.mock.On("RequestValues")}
}
func (_c *IdentificationClientInterface_RequestValues_Call) Run(run func()) *IdentificationClientInterface_RequestValues_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *IdentificationClientInterface_RequestValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IdentificationClientInterface_RequestValues_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *IdentificationClientInterface_RequestValues_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *IdentificationClientInterface_RequestValues_Call {
_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
}
@@ -0,0 +1,139 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// IdentificationCommonInterface is an autogenerated mock type for the IdentificationCommonInterface type
type IdentificationCommonInterface struct {
mock.Mock
}
type IdentificationCommonInterface_Expecter struct {
mock *mock.Mock
}
func (_m *IdentificationCommonInterface) EXPECT() *IdentificationCommonInterface_Expecter {
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)
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)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckEventPayloadDataForFilter'
type IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call struct {
*mock.Call
}
// CheckEventPayloadDataForFilter is a helper method to define mock.On call
// - 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 interface{})) *IdentificationCommonInterface_CheckEventPayloadDataForFilter_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(interface{}))
})
return _c
}
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(interface{}) 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)
if len(ret) == 0 {
panic("no return value specified for GetDataForFilter")
}
var r0 []model.IdentificationDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.IdentificationDataType) ([]model.IdentificationDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.IdentificationDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IdentificationCommonInterface_GetDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDataForFilter'
type IdentificationCommonInterface_GetDataForFilter_Call struct {
*mock.Call
}
// GetDataForFilter is a helper method to define mock.On call
// - filter model.IdentificationDataType
func (_e *IdentificationCommonInterface_Expecter) GetDataForFilter(filter interface{}) *IdentificationCommonInterface_GetDataForFilter_Call {
return &IdentificationCommonInterface_GetDataForFilter_Call{Call: _e.mock.On("GetDataForFilter", filter)}
}
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))
})
return _c
}
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(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
}
@@ -0,0 +1,32 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
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}
}
// 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.
func NewIdentificationServerInterface(t interface {
mock.TestingT
Cleanup(func())
}) *IdentificationServerInterface {
mock := &IdentificationServerInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,322 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// IncentiveTableClientInterface is an autogenerated mock type for the IncentiveTableClientInterface type
type IncentiveTableClientInterface struct {
mock.Mock
}
type IncentiveTableClientInterface_Expecter struct {
mock *mock.Mock
}
func (_m *IncentiveTableClientInterface) EXPECT() *IncentiveTableClientInterface_Expecter {
return &IncentiveTableClientInterface_Expecter{mock: &_m.Mock}
}
// RequestConstraints provides a mock function with given fields:
func (_m *IncentiveTableClientInterface) RequestConstraints() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RequestConstraints")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IncentiveTableClientInterface_RequestConstraints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestConstraints'
type IncentiveTableClientInterface_RequestConstraints_Call struct {
*mock.Call
}
// RequestConstraints is a helper method to define mock.On call
func (_e *IncentiveTableClientInterface_Expecter) RequestConstraints() *IncentiveTableClientInterface_RequestConstraints_Call {
return &IncentiveTableClientInterface_RequestConstraints_Call{Call: _e.mock.On("RequestConstraints")}
}
func (_c *IncentiveTableClientInterface_RequestConstraints_Call) Run(run func()) *IncentiveTableClientInterface_RequestConstraints_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *IncentiveTableClientInterface_RequestConstraints_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_RequestConstraints_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *IncentiveTableClientInterface_RequestConstraints_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *IncentiveTableClientInterface_RequestConstraints_Call {
_c.Call.Return(run)
return _c
}
// RequestDescriptions provides a mock function with given fields:
func (_m *IncentiveTableClientInterface) RequestDescriptions() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RequestDescriptions")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IncentiveTableClientInterface_RequestDescriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestDescriptions'
type IncentiveTableClientInterface_RequestDescriptions_Call struct {
*mock.Call
}
// RequestDescriptions is a helper method to define mock.On call
func (_e *IncentiveTableClientInterface_Expecter) RequestDescriptions() *IncentiveTableClientInterface_RequestDescriptions_Call {
return &IncentiveTableClientInterface_RequestDescriptions_Call{Call: _e.mock.On("RequestDescriptions")}
}
func (_c *IncentiveTableClientInterface_RequestDescriptions_Call) Run(run func()) *IncentiveTableClientInterface_RequestDescriptions_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *IncentiveTableClientInterface_RequestDescriptions_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_RequestDescriptions_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *IncentiveTableClientInterface_RequestDescriptions_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *IncentiveTableClientInterface_RequestDescriptions_Call {
_c.Call.Return(run)
return _c
}
// RequestValues provides a mock function with given fields:
func (_m *IncentiveTableClientInterface) RequestValues() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RequestValues")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IncentiveTableClientInterface_RequestValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestValues'
type IncentiveTableClientInterface_RequestValues_Call struct {
*mock.Call
}
// RequestValues is a helper method to define mock.On call
func (_e *IncentiveTableClientInterface_Expecter) RequestValues() *IncentiveTableClientInterface_RequestValues_Call {
return &IncentiveTableClientInterface_RequestValues_Call{Call: _e.mock.On("RequestValues")}
}
func (_c *IncentiveTableClientInterface_RequestValues_Call) Run(run func()) *IncentiveTableClientInterface_RequestValues_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *IncentiveTableClientInterface_RequestValues_Call) Return(_a0 *model.MsgCounterType, _a1 error) *IncentiveTableClientInterface_RequestValues_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *IncentiveTableClientInterface_RequestValues_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *IncentiveTableClientInterface_RequestValues_Call {
_c.Call.Return(run)
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)
if len(ret) == 0 {
panic("no return value specified for WriteDescriptions")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func([]model.IncentiveTableDescriptionType) (*model.MsgCounterType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func([]model.IncentiveTableDescriptionType) error); ok {
r1 = rf(data)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IncentiveTableClientInterface_WriteDescriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteDescriptions'
type IncentiveTableClientInterface_WriteDescriptions_Call struct {
*mock.Call
}
// WriteDescriptions is a helper method to define mock.On call
// - data []model.IncentiveTableDescriptionType
func (_e *IncentiveTableClientInterface_Expecter) WriteDescriptions(data interface{}) *IncentiveTableClientInterface_WriteDescriptions_Call {
return &IncentiveTableClientInterface_WriteDescriptions_Call{Call: _e.mock.On("WriteDescriptions", data)}
}
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))
})
return _c
}
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([]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)
if len(ret) == 0 {
panic("no return value specified for WriteValues")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func([]model.IncentiveTableType) (*model.MsgCounterType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func([]model.IncentiveTableType) error); ok {
r1 = rf(data)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IncentiveTableClientInterface_WriteValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteValues'
type IncentiveTableClientInterface_WriteValues_Call struct {
*mock.Call
}
// WriteValues is a helper method to define mock.On call
// - data []model.IncentiveTableType
func (_e *IncentiveTableClientInterface_Expecter) WriteValues(data interface{}) *IncentiveTableClientInterface_WriteValues_Call {
return &IncentiveTableClientInterface_WriteValues_Call{Call: _e.mock.On("WriteValues", data)}
}
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))
})
return _c
}
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([]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
}
@@ -0,0 +1,207 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// IncentiveTableCommonInterface is an autogenerated mock type for the IncentiveTableCommonInterface type
type IncentiveTableCommonInterface struct {
mock.Mock
}
type IncentiveTableCommonInterface_Expecter struct {
mock *mock.Mock
}
func (_m *IncentiveTableCommonInterface) EXPECT() *IncentiveTableCommonInterface_Expecter {
return &IncentiveTableCommonInterface_Expecter{mock: &_m.Mock}
}
// GetConstraints provides a mock function with given fields:
func (_m *IncentiveTableCommonInterface) GetConstraints() ([]model.IncentiveTableConstraintsType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetConstraints")
}
var r0 []model.IncentiveTableConstraintsType
var r1 error
if rf, ok := ret.Get(0).(func() ([]model.IncentiveTableConstraintsType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IncentiveTableCommonInterface_GetConstraints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConstraints'
type IncentiveTableCommonInterface_GetConstraints_Call struct {
*mock.Call
}
// GetConstraints is a helper method to define mock.On call
func (_e *IncentiveTableCommonInterface_Expecter) GetConstraints() *IncentiveTableCommonInterface_GetConstraints_Call {
return &IncentiveTableCommonInterface_GetConstraints_Call{Call: _e.mock.On("GetConstraints")}
}
func (_c *IncentiveTableCommonInterface_GetConstraints_Call) Run(run func()) *IncentiveTableCommonInterface_GetConstraints_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *IncentiveTableCommonInterface_GetConstraints_Call) Return(_a0 []model.IncentiveTableConstraintsType, _a1 error) *IncentiveTableCommonInterface_GetConstraints_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *IncentiveTableCommonInterface_GetConstraints_Call) RunAndReturn(run func() ([]model.IncentiveTableConstraintsType, error)) *IncentiveTableCommonInterface_GetConstraints_Call {
_c.Call.Return(run)
return _c
}
// GetData provides a mock function with given fields:
func (_m *IncentiveTableCommonInterface) GetData() ([]model.IncentiveTableType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetData")
}
var r0 []model.IncentiveTableType
var r1 error
if rf, ok := ret.Get(0).(func() ([]model.IncentiveTableType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IncentiveTableCommonInterface_GetData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetData'
type IncentiveTableCommonInterface_GetData_Call struct {
*mock.Call
}
// GetData is a helper method to define mock.On call
func (_e *IncentiveTableCommonInterface_Expecter) GetData() *IncentiveTableCommonInterface_GetData_Call {
return &IncentiveTableCommonInterface_GetData_Call{Call: _e.mock.On("GetData")}
}
func (_c *IncentiveTableCommonInterface_GetData_Call) Run(run func()) *IncentiveTableCommonInterface_GetData_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *IncentiveTableCommonInterface_GetData_Call) Return(_a0 []model.IncentiveTableType, _a1 error) *IncentiveTableCommonInterface_GetData_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *IncentiveTableCommonInterface_GetData_Call) RunAndReturn(run func() ([]model.IncentiveTableType, error)) *IncentiveTableCommonInterface_GetData_Call {
_c.Call.Return(run)
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)
if len(ret) == 0 {
panic("no return value specified for GetDescriptionsForFilter")
}
var r0 []model.IncentiveTableDescriptionType
var r1 error
if rf, ok := ret.Get(0).(func(model.TariffDescriptionDataType) ([]model.IncentiveTableDescriptionType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.TariffDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IncentiveTableCommonInterface_GetDescriptionsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDescriptionsForFilter'
type IncentiveTableCommonInterface_GetDescriptionsForFilter_Call struct {
*mock.Call
}
// GetDescriptionsForFilter is a helper method to define mock.On call
// - filter model.TariffDescriptionDataType
func (_e *IncentiveTableCommonInterface_Expecter) GetDescriptionsForFilter(filter interface{}) *IncentiveTableCommonInterface_GetDescriptionsForFilter_Call {
return &IncentiveTableCommonInterface_GetDescriptionsForFilter_Call{Call: _e.mock.On("GetDescriptionsForFilter", filter)}
}
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))
})
return _c
}
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(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
}
@@ -0,0 +1,32 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
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}
}
// 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.
func NewIncentiveTableServerInterface(t interface {
mock.TestingT
Cleanup(func())
}) *IncentiveTableServerInterface {
mock := &IncentiveTableServerInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,272 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// LoadControlClientInterface is an autogenerated mock type for the LoadControlClientInterface type
type LoadControlClientInterface struct {
mock.Mock
}
type LoadControlClientInterface_Expecter struct {
mock *mock.Mock
}
func (_m *LoadControlClientInterface) EXPECT() *LoadControlClientInterface_Expecter {
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)
if len(ret) == 0 {
panic("no return value specified for RequestLimitConstraints")
}
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 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 rf, ok := ret.Get(1).(func(*model.LoadControlLimitConstraintsListDataSelectorsType, *model.LoadControlLimitConstraintsDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// LoadControlClientInterface_RequestLimitConstraints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestLimitConstraints'
type LoadControlClientInterface_RequestLimitConstraints_Call struct {
*mock.Call
}
// RequestLimitConstraints is a helper method to define mock.On call
// - selector *model.LoadControlLimitConstraintsListDataSelectorsType
// - elements *model.LoadControlLimitConstraintsDataElementsType
func (_e *LoadControlClientInterface_Expecter) RequestLimitConstraints(selector interface{}, elements interface{}) *LoadControlClientInterface_RequestLimitConstraints_Call {
return &LoadControlClientInterface_RequestLimitConstraints_Call{Call: _e.mock.On("RequestLimitConstraints", selector, elements)}
}
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))
})
return _c
}
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(*model.LoadControlLimitConstraintsListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for RequestLimitData")
}
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 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 rf, ok := ret.Get(1).(func(*model.LoadControlLimitListDataSelectorsType, *model.LoadControlLimitDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// LoadControlClientInterface_RequestLimitData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestLimitData'
type LoadControlClientInterface_RequestLimitData_Call struct {
*mock.Call
}
// RequestLimitData is a helper method to define mock.On call
// - selector *model.LoadControlLimitListDataSelectorsType
// - elements *model.LoadControlLimitDataElementsType
func (_e *LoadControlClientInterface_Expecter) RequestLimitData(selector interface{}, elements interface{}) *LoadControlClientInterface_RequestLimitData_Call {
return &LoadControlClientInterface_RequestLimitData_Call{Call: _e.mock.On("RequestLimitData", selector, elements)}
}
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))
})
return _c
}
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(*model.LoadControlLimitListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for RequestLimitDescriptions")
}
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 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 rf, ok := ret.Get(1).(func(*model.LoadControlLimitDescriptionListDataSelectorsType, *model.LoadControlLimitDescriptionDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// LoadControlClientInterface_RequestLimitDescriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestLimitDescriptions'
type LoadControlClientInterface_RequestLimitDescriptions_Call struct {
*mock.Call
}
// RequestLimitDescriptions is a helper method to define mock.On call
// - selector *model.LoadControlLimitDescriptionListDataSelectorsType
// - elements *model.LoadControlLimitDescriptionDataElementsType
func (_e *LoadControlClientInterface_Expecter) RequestLimitDescriptions(selector interface{}, elements interface{}) *LoadControlClientInterface_RequestLimitDescriptions_Call {
return &LoadControlClientInterface_RequestLimitDescriptions_Call{Call: _e.mock.On("RequestLimitDescriptions", selector, elements)}
}
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))
})
return _c
}
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(*model.LoadControlLimitDescriptionListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for WriteLimitData")
}
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 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 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
}
// LoadControlClientInterface_WriteLimitData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteLimitData'
type LoadControlClientInterface_WriteLimitData_Call struct {
*mock.Call
}
// WriteLimitData is a helper method to define mock.On call
// - data []model.LoadControlLimitDataType
// - deleteSelectors *model.LoadControlLimitListDataSelectorsType
// - deleteElements *model.LoadControlLimitDataElementsType
func (_e *LoadControlClientInterface_Expecter) WriteLimitData(data interface{}, deleteSelectors interface{}, deleteElements interface{}) *LoadControlClientInterface_WriteLimitData_Call {
return &LoadControlClientInterface_WriteLimitData_Call{Call: _e.mock.On("WriteLimitData", data, deleteSelectors, deleteElements)}
}
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))
})
return _c
}
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([]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
}
@@ -0,0 +1,314 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// LoadControlCommonInterface is an autogenerated mock type for the LoadControlCommonInterface type
type LoadControlCommonInterface struct {
mock.Mock
}
type LoadControlCommonInterface_Expecter struct {
mock *mock.Mock
}
func (_m *LoadControlCommonInterface) EXPECT() *LoadControlCommonInterface_Expecter {
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)
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)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckEventPayloadDataForFilter'
type LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call struct {
*mock.Call
}
// CheckEventPayloadDataForFilter is a helper method to define mock.On call
// - 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 interface{}, filter interface{})) *LoadControlCommonInterface_CheckEventPayloadDataForFilter_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(interface{}), args[1].(interface{}))
})
return _c
}
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(interface{}, interface{}) 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)
if len(ret) == 0 {
panic("no return value specified for GetLimitDataForFilter")
}
var r0 []model.LoadControlLimitDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.LoadControlLimitDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// LoadControlCommonInterface_GetLimitDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLimitDataForFilter'
type LoadControlCommonInterface_GetLimitDataForFilter_Call struct {
*mock.Call
}
// GetLimitDataForFilter is a helper method to define mock.On call
// - filter model.LoadControlLimitDescriptionDataType
func (_e *LoadControlCommonInterface_Expecter) GetLimitDataForFilter(filter interface{}) *LoadControlCommonInterface_GetLimitDataForFilter_Call {
return &LoadControlCommonInterface_GetLimitDataForFilter_Call{Call: _e.mock.On("GetLimitDataForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetLimitDataForId")
}
var r0 *model.LoadControlLimitDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.LoadControlLimitIdType) (*model.LoadControlLimitDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.LoadControlLimitIdType) error); ok {
r1 = rf(limitId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// LoadControlCommonInterface_GetLimitDataForId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLimitDataForId'
type LoadControlCommonInterface_GetLimitDataForId_Call struct {
*mock.Call
}
// GetLimitDataForId is a helper method to define mock.On call
// - limitId model.LoadControlLimitIdType
func (_e *LoadControlCommonInterface_Expecter) GetLimitDataForId(limitId interface{}) *LoadControlCommonInterface_GetLimitDataForId_Call {
return &LoadControlCommonInterface_GetLimitDataForId_Call{Call: _e.mock.On("GetLimitDataForId", limitId)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetLimitDescriptionForId")
}
var r0 *model.LoadControlLimitDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.LoadControlLimitIdType) (*model.LoadControlLimitDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.LoadControlLimitIdType) error); ok {
r1 = rf(limitId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// LoadControlCommonInterface_GetLimitDescriptionForId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLimitDescriptionForId'
type LoadControlCommonInterface_GetLimitDescriptionForId_Call struct {
*mock.Call
}
// GetLimitDescriptionForId is a helper method to define mock.On call
// - limitId model.LoadControlLimitIdType
func (_e *LoadControlCommonInterface_Expecter) GetLimitDescriptionForId(limitId interface{}) *LoadControlCommonInterface_GetLimitDescriptionForId_Call {
return &LoadControlCommonInterface_GetLimitDescriptionForId_Call{Call: _e.mock.On("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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetLimitDescriptionsForFilter")
}
var r0 []model.LoadControlLimitDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.LoadControlLimitDescriptionDataType) ([]model.LoadControlLimitDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.LoadControlLimitDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLimitDescriptionsForFilter'
type LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call struct {
*mock.Call
}
// GetLimitDescriptionsForFilter is a helper method to define mock.On call
// - filter model.LoadControlLimitDescriptionDataType
func (_e *LoadControlCommonInterface_Expecter) GetLimitDescriptionsForFilter(filter interface{}) *LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call {
return &LoadControlCommonInterface_GetLimitDescriptionsForFilter_Call{Call: _e.mock.On("GetLimitDescriptionsForFilter", filter)}
}
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))
})
return _c
}
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(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
}
@@ -0,0 +1,179 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// LoadControlServerInterface is an autogenerated mock type for the LoadControlServerInterface type
type LoadControlServerInterface struct {
mock.Mock
}
type LoadControlServerInterface_Expecter struct {
mock *mock.Mock
}
func (_m *LoadControlServerInterface) EXPECT() *LoadControlServerInterface_Expecter {
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)
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)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.LoadControlLimitIdType)
}
}
return r0
}
// LoadControlServerInterface_AddLimitDescription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddLimitDescription'
type LoadControlServerInterface_AddLimitDescription_Call struct {
*mock.Call
}
// AddLimitDescription is a helper method to define mock.On call
// - description model.LoadControlLimitDescriptionDataType
func (_e *LoadControlServerInterface_Expecter) AddLimitDescription(description interface{}) *LoadControlServerInterface_AddLimitDescription_Call {
return &LoadControlServerInterface_AddLimitDescription_Call{Call: _e.mock.On("AddLimitDescription", description)}
}
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))
})
return _c
}
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(model.LoadControlLimitDescriptionDataType) *model.LoadControlLimitIdType) *LoadControlServerInterface_AddLimitDescription_Call {
_c.Call.Return(run)
return _c
}
// UpdateLimitDataForFilter provides a mock function with given fields: data, deleteElements, filter
func (_m *LoadControlServerInterface) UpdateLimitDataForFilter(data model.LoadControlLimitDataType, deleteElements *model.LoadControlLimitDataElementsType, filter model.LoadControlLimitDescriptionDataType) error {
ret := _m.Called(data, deleteElements, filter)
if len(ret) == 0 {
panic("no return value specified for UpdateLimitDataForFilter")
}
var r0 error
if rf, ok := ret.Get(0).(func(model.LoadControlLimitDataType, *model.LoadControlLimitDataElementsType, model.LoadControlLimitDescriptionDataType) error); ok {
r0 = rf(data, deleteElements, filter)
} else {
r0 = ret.Error(0)
}
return r0
}
// LoadControlServerInterface_UpdateLimitDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateLimitDataForFilter'
type LoadControlServerInterface_UpdateLimitDataForFilter_Call struct {
*mock.Call
}
// UpdateLimitDataForFilter is a helper method to define mock.On call
// - data model.LoadControlLimitDataType
// - deleteElements *model.LoadControlLimitDataElementsType
// - filter model.LoadControlLimitDescriptionDataType
func (_e *LoadControlServerInterface_Expecter) UpdateLimitDataForFilter(data interface{}, deleteElements interface{}, filter interface{}) *LoadControlServerInterface_UpdateLimitDataForFilter_Call {
return &LoadControlServerInterface_UpdateLimitDataForFilter_Call{Call: _e.mock.On("UpdateLimitDataForFilter", data, deleteElements, filter)}
}
func (_c *LoadControlServerInterface_UpdateLimitDataForFilter_Call) Run(run func(data model.LoadControlLimitDataType, deleteElements *model.LoadControlLimitDataElementsType, filter model.LoadControlLimitDescriptionDataType)) *LoadControlServerInterface_UpdateLimitDataForFilter_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(model.LoadControlLimitDataType), args[1].(*model.LoadControlLimitDataElementsType), args[2].(model.LoadControlLimitDescriptionDataType))
})
return _c
}
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(model.LoadControlLimitDataType, *model.LoadControlLimitDataElementsType, model.LoadControlLimitDescriptionDataType) error) *LoadControlServerInterface_UpdateLimitDataForFilter_Call {
_c.Call.Return(run)
return _c
}
// UpdateLimitDataForId provides a mock function with given fields: data, deleteElements, limitId
func (_m *LoadControlServerInterface) UpdateLimitDataForId(data model.LoadControlLimitDataType, deleteElements *model.LoadControlLimitDataElementsType, limitId model.LoadControlLimitIdType) error {
ret := _m.Called(data, deleteElements, limitId)
if len(ret) == 0 {
panic("no return value specified for UpdateLimitDataForId")
}
var r0 error
if rf, ok := ret.Get(0).(func(model.LoadControlLimitDataType, *model.LoadControlLimitDataElementsType, model.LoadControlLimitIdType) error); ok {
r0 = rf(data, deleteElements, limitId)
} else {
r0 = ret.Error(0)
}
return r0
}
// LoadControlServerInterface_UpdateLimitDataForId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateLimitDataForId'
type LoadControlServerInterface_UpdateLimitDataForId_Call struct {
*mock.Call
}
// UpdateLimitDataForId is a helper method to define mock.On call
// - data model.LoadControlLimitDataType
// - deleteElements *model.LoadControlLimitDataElementsType
// - limitId model.LoadControlLimitIdType
func (_e *LoadControlServerInterface_Expecter) UpdateLimitDataForId(data interface{}, deleteElements interface{}, limitId interface{}) *LoadControlServerInterface_UpdateLimitDataForId_Call {
return &LoadControlServerInterface_UpdateLimitDataForId_Call{Call: _e.mock.On("UpdateLimitDataForId", data, deleteElements, limitId)}
}
func (_c *LoadControlServerInterface_UpdateLimitDataForId_Call) Run(run func(data model.LoadControlLimitDataType, deleteElements *model.LoadControlLimitDataElementsType, limitId model.LoadControlLimitIdType)) *LoadControlServerInterface_UpdateLimitDataForId_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(model.LoadControlLimitDataType), args[1].(*model.LoadControlLimitDataElementsType), args[2].(model.LoadControlLimitIdType))
})
return _c
}
func (_c *LoadControlServerInterface_UpdateLimitDataForId_Call) Return(_a0 error) *LoadControlServerInterface_UpdateLimitDataForId_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *LoadControlServerInterface_UpdateLimitDataForId_Call) RunAndReturn(run func(model.LoadControlLimitDataType, *model.LoadControlLimitDataElementsType, model.LoadControlLimitIdType) error) *LoadControlServerInterface_UpdateLimitDataForId_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
}
@@ -0,0 +1,212 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// MeasurementClientInterface is an autogenerated mock type for the MeasurementClientInterface type
type MeasurementClientInterface struct {
mock.Mock
}
type MeasurementClientInterface_Expecter struct {
mock *mock.Mock
}
func (_m *MeasurementClientInterface) EXPECT() *MeasurementClientInterface_Expecter {
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)
if len(ret) == 0 {
panic("no return value specified for RequestConstraints")
}
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 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 rf, ok := ret.Get(1).(func(*model.MeasurementConstraintsListDataSelectorsType, *model.MeasurementConstraintsDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MeasurementClientInterface_RequestConstraints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestConstraints'
type MeasurementClientInterface_RequestConstraints_Call struct {
*mock.Call
}
// RequestConstraints is a helper method to define mock.On call
// - selector *model.MeasurementConstraintsListDataSelectorsType
// - elements *model.MeasurementConstraintsDataElementsType
func (_e *MeasurementClientInterface_Expecter) RequestConstraints(selector interface{}, elements interface{}) *MeasurementClientInterface_RequestConstraints_Call {
return &MeasurementClientInterface_RequestConstraints_Call{Call: _e.mock.On("RequestConstraints", selector, elements)}
}
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))
})
return _c
}
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(*model.MeasurementConstraintsListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for RequestData")
}
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 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 rf, ok := ret.Get(1).(func(*model.MeasurementListDataSelectorsType, *model.MeasurementDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MeasurementClientInterface_RequestData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestData'
type MeasurementClientInterface_RequestData_Call struct {
*mock.Call
}
// RequestData is a helper method to define mock.On call
// - selector *model.MeasurementListDataSelectorsType
// - elements *model.MeasurementDataElementsType
func (_e *MeasurementClientInterface_Expecter) RequestData(selector interface{}, elements interface{}) *MeasurementClientInterface_RequestData_Call {
return &MeasurementClientInterface_RequestData_Call{Call: _e.mock.On("RequestData", selector, elements)}
}
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))
})
return _c
}
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(*model.MeasurementListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for RequestDescriptions")
}
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 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 rf, ok := ret.Get(1).(func(*model.MeasurementDescriptionListDataSelectorsType, *model.MeasurementDescriptionDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MeasurementClientInterface_RequestDescriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestDescriptions'
type MeasurementClientInterface_RequestDescriptions_Call struct {
*mock.Call
}
// RequestDescriptions is a helper method to define mock.On call
// - selector *model.MeasurementDescriptionListDataSelectorsType
// - elements *model.MeasurementDescriptionDataElementsType
func (_e *MeasurementClientInterface_Expecter) RequestDescriptions(selector interface{}, elements interface{}) *MeasurementClientInterface_RequestDescriptions_Call {
return &MeasurementClientInterface_RequestDescriptions_Call{Call: _e.mock.On("RequestDescriptions", selector, elements)}
}
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))
})
return _c
}
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(*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
}
@@ -0,0 +1,372 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// MeasurementCommonInterface is an autogenerated mock type for the MeasurementCommonInterface type
type MeasurementCommonInterface struct {
mock.Mock
}
type MeasurementCommonInterface_Expecter struct {
mock *mock.Mock
}
func (_m *MeasurementCommonInterface) EXPECT() *MeasurementCommonInterface_Expecter {
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)
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)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckEventPayloadDataForFilter'
type MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call struct {
*mock.Call
}
// CheckEventPayloadDataForFilter is a helper method to define mock.On call
// - 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 interface{}, filter interface{})) *MeasurementCommonInterface_CheckEventPayloadDataForFilter_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(interface{}), args[1].(interface{}))
})
return _c
}
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(interface{}, interface{}) 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)
if len(ret) == 0 {
panic("no return value specified for GetConstraintsForFilter")
}
var r0 []model.MeasurementConstraintsDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.MeasurementConstraintsDataType) ([]model.MeasurementConstraintsDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.MeasurementConstraintsDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MeasurementCommonInterface_GetConstraintsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConstraintsForFilter'
type MeasurementCommonInterface_GetConstraintsForFilter_Call struct {
*mock.Call
}
// GetConstraintsForFilter is a helper method to define mock.On call
// - filter model.MeasurementConstraintsDataType
func (_e *MeasurementCommonInterface_Expecter) GetConstraintsForFilter(filter interface{}) *MeasurementCommonInterface_GetConstraintsForFilter_Call {
return &MeasurementCommonInterface_GetConstraintsForFilter_Call{Call: _e.mock.On("GetConstraintsForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetDataForFilter")
}
var r0 []model.MeasurementDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) ([]model.MeasurementDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.MeasurementDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MeasurementCommonInterface_GetDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDataForFilter'
type MeasurementCommonInterface_GetDataForFilter_Call struct {
*mock.Call
}
// GetDataForFilter is a helper method to define mock.On call
// - filter model.MeasurementDescriptionDataType
func (_e *MeasurementCommonInterface_Expecter) GetDataForFilter(filter interface{}) *MeasurementCommonInterface_GetDataForFilter_Call {
return &MeasurementCommonInterface_GetDataForFilter_Call{Call: _e.mock.On("GetDataForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetDataForId")
}
var r0 *model.MeasurementDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.MeasurementIdType) (*model.MeasurementDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.MeasurementIdType) error); ok {
r1 = rf(measurementId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MeasurementCommonInterface_GetDataForId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDataForId'
type MeasurementCommonInterface_GetDataForId_Call struct {
*mock.Call
}
// GetDataForId is a helper method to define mock.On call
// - measurementId model.MeasurementIdType
func (_e *MeasurementCommonInterface_Expecter) GetDataForId(measurementId interface{}) *MeasurementCommonInterface_GetDataForId_Call {
return &MeasurementCommonInterface_GetDataForId_Call{Call: _e.mock.On("GetDataForId", measurementId)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetDescriptionForId")
}
var r0 *model.MeasurementDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.MeasurementIdType) (*model.MeasurementDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.MeasurementIdType) error); ok {
r1 = rf(measurementId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MeasurementCommonInterface_GetDescriptionForId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDescriptionForId'
type MeasurementCommonInterface_GetDescriptionForId_Call struct {
*mock.Call
}
// GetDescriptionForId is a helper method to define mock.On call
// - measurementId model.MeasurementIdType
func (_e *MeasurementCommonInterface_Expecter) GetDescriptionForId(measurementId interface{}) *MeasurementCommonInterface_GetDescriptionForId_Call {
return &MeasurementCommonInterface_GetDescriptionForId_Call{Call: _e.mock.On("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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetDescriptionsForFilter")
}
var r0 []model.MeasurementDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.MeasurementDescriptionDataType) ([]model.MeasurementDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.MeasurementDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MeasurementCommonInterface_GetDescriptionsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDescriptionsForFilter'
type MeasurementCommonInterface_GetDescriptionsForFilter_Call struct {
*mock.Call
}
// GetDescriptionsForFilter is a helper method to define mock.On call
// - filter model.MeasurementDescriptionDataType
func (_e *MeasurementCommonInterface_Expecter) GetDescriptionsForFilter(filter interface{}) *MeasurementCommonInterface_GetDescriptionsForFilter_Call {
return &MeasurementCommonInterface_GetDescriptionsForFilter_Call{Call: _e.mock.On("GetDescriptionsForFilter", filter)}
}
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))
})
return _c
}
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(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
}
@@ -0,0 +1,179 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// MeasurementServerInterface is an autogenerated mock type for the MeasurementServerInterface type
type MeasurementServerInterface struct {
mock.Mock
}
type MeasurementServerInterface_Expecter struct {
mock *mock.Mock
}
func (_m *MeasurementServerInterface) EXPECT() *MeasurementServerInterface_Expecter {
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)
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)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.MeasurementIdType)
}
}
return r0
}
// MeasurementServerInterface_AddDescription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddDescription'
type MeasurementServerInterface_AddDescription_Call struct {
*mock.Call
}
// AddDescription is a helper method to define mock.On call
// - description model.MeasurementDescriptionDataType
func (_e *MeasurementServerInterface_Expecter) AddDescription(description interface{}) *MeasurementServerInterface_AddDescription_Call {
return &MeasurementServerInterface_AddDescription_Call{Call: _e.mock.On("AddDescription", description)}
}
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))
})
return _c
}
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(model.MeasurementDescriptionDataType) *model.MeasurementIdType) *MeasurementServerInterface_AddDescription_Call {
_c.Call.Return(run)
return _c
}
// UpdateDataForFilter provides a mock function with given fields: data, deleteElements, filter
func (_m *MeasurementServerInterface) UpdateDataForFilter(data model.MeasurementDataType, deleteElements *model.MeasurementDataElementsType, filter model.MeasurementDescriptionDataType) error {
ret := _m.Called(data, deleteElements, filter)
if len(ret) == 0 {
panic("no return value specified for UpdateDataForFilter")
}
var r0 error
if rf, ok := ret.Get(0).(func(model.MeasurementDataType, *model.MeasurementDataElementsType, model.MeasurementDescriptionDataType) error); ok {
r0 = rf(data, deleteElements, filter)
} else {
r0 = ret.Error(0)
}
return r0
}
// MeasurementServerInterface_UpdateDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataForFilter'
type MeasurementServerInterface_UpdateDataForFilter_Call struct {
*mock.Call
}
// UpdateDataForFilter is a helper method to define mock.On call
// - data model.MeasurementDataType
// - deleteElements *model.MeasurementDataElementsType
// - filter model.MeasurementDescriptionDataType
func (_e *MeasurementServerInterface_Expecter) UpdateDataForFilter(data interface{}, deleteElements interface{}, filter interface{}) *MeasurementServerInterface_UpdateDataForFilter_Call {
return &MeasurementServerInterface_UpdateDataForFilter_Call{Call: _e.mock.On("UpdateDataForFilter", data, deleteElements, filter)}
}
func (_c *MeasurementServerInterface_UpdateDataForFilter_Call) Run(run func(data model.MeasurementDataType, deleteElements *model.MeasurementDataElementsType, filter model.MeasurementDescriptionDataType)) *MeasurementServerInterface_UpdateDataForFilter_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(model.MeasurementDataType), args[1].(*model.MeasurementDataElementsType), args[2].(model.MeasurementDescriptionDataType))
})
return _c
}
func (_c *MeasurementServerInterface_UpdateDataForFilter_Call) Return(_a0 error) *MeasurementServerInterface_UpdateDataForFilter_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MeasurementServerInterface_UpdateDataForFilter_Call) RunAndReturn(run func(model.MeasurementDataType, *model.MeasurementDataElementsType, model.MeasurementDescriptionDataType) error) *MeasurementServerInterface_UpdateDataForFilter_Call {
_c.Call.Return(run)
return _c
}
// UpdateDataForId provides a mock function with given fields: data, deleteElements, measurementId
func (_m *MeasurementServerInterface) UpdateDataForId(data model.MeasurementDataType, deleteElements *model.MeasurementDataElementsType, measurementId model.MeasurementIdType) error {
ret := _m.Called(data, deleteElements, measurementId)
if len(ret) == 0 {
panic("no return value specified for UpdateDataForId")
}
var r0 error
if rf, ok := ret.Get(0).(func(model.MeasurementDataType, *model.MeasurementDataElementsType, model.MeasurementIdType) error); ok {
r0 = rf(data, deleteElements, measurementId)
} else {
r0 = ret.Error(0)
}
return r0
}
// MeasurementServerInterface_UpdateDataForId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDataForId'
type MeasurementServerInterface_UpdateDataForId_Call struct {
*mock.Call
}
// UpdateDataForId is a helper method to define mock.On call
// - data model.MeasurementDataType
// - deleteElements *model.MeasurementDataElementsType
// - measurementId model.MeasurementIdType
func (_e *MeasurementServerInterface_Expecter) UpdateDataForId(data interface{}, deleteElements interface{}, measurementId interface{}) *MeasurementServerInterface_UpdateDataForId_Call {
return &MeasurementServerInterface_UpdateDataForId_Call{Call: _e.mock.On("UpdateDataForId", data, deleteElements, measurementId)}
}
func (_c *MeasurementServerInterface_UpdateDataForId_Call) Run(run func(data model.MeasurementDataType, deleteElements *model.MeasurementDataElementsType, measurementId model.MeasurementIdType)) *MeasurementServerInterface_UpdateDataForId_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(model.MeasurementDataType), args[1].(*model.MeasurementDataElementsType), args[2].(model.MeasurementIdType))
})
return _c
}
func (_c *MeasurementServerInterface_UpdateDataForId_Call) Return(_a0 error) *MeasurementServerInterface_UpdateDataForId_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MeasurementServerInterface_UpdateDataForId_Call) RunAndReturn(run func(model.MeasurementDataType, *model.MeasurementDataElementsType, model.MeasurementIdType) error) *MeasurementServerInterface_UpdateDataForId_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
}
@@ -0,0 +1,697 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
api "github.com/enbility/eebus-go/api"
logging "github.com/enbility/ship-go/logging"
mock "github.com/stretchr/testify/mock"
ship_goapi "github.com/enbility/ship-go/api"
spine_goapi "github.com/enbility/spine-go/api"
)
// ServiceInterface is an autogenerated mock type for the ServiceInterface type
type ServiceInterface struct {
mock.Mock
}
type ServiceInterface_Expecter struct {
mock *mock.Mock
}
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) {
_m.Called(useCase)
}
// ServiceInterface_AddUseCase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUseCase'
type ServiceInterface_AddUseCase_Call struct {
*mock.Call
}
// AddUseCase is a helper method to define mock.On call
// - useCase api.UseCaseInterface
func (_e *ServiceInterface_Expecter) AddUseCase(useCase interface{}) *ServiceInterface_AddUseCase_Call {
return &ServiceInterface_AddUseCase_Call{Call: _e.mock.On("AddUseCase", useCase)}
}
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))
})
return _c
}
func (_c *ServiceInterface_AddUseCase_Call) Return() *ServiceInterface_AddUseCase_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceInterface_AddUseCase_Call) RunAndReturn(run func(api.UseCaseInterface)) *ServiceInterface_AddUseCase_Call {
_c.Call.Return(run)
return _c
}
// CancelPairingWithSKI provides a mock function with given fields: ski
func (_m *ServiceInterface) CancelPairingWithSKI(ski string) {
_m.Called(ski)
}
// ServiceInterface_CancelPairingWithSKI_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CancelPairingWithSKI'
type ServiceInterface_CancelPairingWithSKI_Call struct {
*mock.Call
}
// CancelPairingWithSKI is a helper method to define mock.On call
// - ski string
func (_e *ServiceInterface_Expecter) CancelPairingWithSKI(ski interface{}) *ServiceInterface_CancelPairingWithSKI_Call {
return &ServiceInterface_CancelPairingWithSKI_Call{Call: _e.mock.On("CancelPairingWithSKI", ski)}
}
func (_c *ServiceInterface_CancelPairingWithSKI_Call) Run(run func(ski string)) *ServiceInterface_CancelPairingWithSKI_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *ServiceInterface_CancelPairingWithSKI_Call) Return() *ServiceInterface_CancelPairingWithSKI_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceInterface_CancelPairingWithSKI_Call) RunAndReturn(run func(string)) *ServiceInterface_CancelPairingWithSKI_Call {
_c.Call.Return(run)
return _c
}
// Configuration provides a mock function with given 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 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
}
// ServiceInterface_Configuration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Configuration'
type ServiceInterface_Configuration_Call struct {
*mock.Call
}
// Configuration is a helper method to define mock.On call
func (_e *ServiceInterface_Expecter) Configuration() *ServiceInterface_Configuration_Call {
return &ServiceInterface_Configuration_Call{Call: _e.mock.On("Configuration")}
}
func (_c *ServiceInterface_Configuration_Call) Run(run func()) *ServiceInterface_Configuration_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *ServiceInterface_Configuration_Call) Return(_a0 *api.Configuration) *ServiceInterface_Configuration_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *ServiceInterface_Configuration_Call) RunAndReturn(run func() *api.Configuration) *ServiceInterface_Configuration_Call {
_c.Call.Return(run)
return _c
}
// DisconnectSKI provides a mock function with given fields: ski, reason
func (_m *ServiceInterface) DisconnectSKI(ski string, reason string) {
_m.Called(ski, reason)
}
// ServiceInterface_DisconnectSKI_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisconnectSKI'
type ServiceInterface_DisconnectSKI_Call struct {
*mock.Call
}
// DisconnectSKI is a helper method to define mock.On call
// - ski string
// - reason string
func (_e *ServiceInterface_Expecter) DisconnectSKI(ski interface{}, reason interface{}) *ServiceInterface_DisconnectSKI_Call {
return &ServiceInterface_DisconnectSKI_Call{Call: _e.mock.On("DisconnectSKI", ski, reason)}
}
func (_c *ServiceInterface_DisconnectSKI_Call) Run(run func(ski string, reason string)) *ServiceInterface_DisconnectSKI_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string))
})
return _c
}
func (_c *ServiceInterface_DisconnectSKI_Call) Return() *ServiceInterface_DisconnectSKI_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceInterface_DisconnectSKI_Call) RunAndReturn(run func(string, string)) *ServiceInterface_DisconnectSKI_Call {
_c.Call.Return(run)
return _c
}
// IsAutoAcceptEnabled provides a mock function with given fields:
func (_m *ServiceInterface) IsAutoAcceptEnabled() bool {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for IsAutoAcceptEnabled")
}
var r0 bool
if rf, ok := ret.Get(0).(func() bool); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// ServiceInterface_IsAutoAcceptEnabled_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsAutoAcceptEnabled'
type ServiceInterface_IsAutoAcceptEnabled_Call struct {
*mock.Call
}
// IsAutoAcceptEnabled is a helper method to define mock.On call
func (_e *ServiceInterface_Expecter) IsAutoAcceptEnabled() *ServiceInterface_IsAutoAcceptEnabled_Call {
return &ServiceInterface_IsAutoAcceptEnabled_Call{Call: _e.mock.On("IsAutoAcceptEnabled")}
}
func (_c *ServiceInterface_IsAutoAcceptEnabled_Call) Run(run func()) *ServiceInterface_IsAutoAcceptEnabled_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *ServiceInterface_IsAutoAcceptEnabled_Call) Return(_a0 bool) *ServiceInterface_IsAutoAcceptEnabled_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *ServiceInterface_IsAutoAcceptEnabled_Call) RunAndReturn(run func() bool) *ServiceInterface_IsAutoAcceptEnabled_Call {
_c.Call.Return(run)
return _c
}
// LocalDevice provides a mock function with given fields:
func (_m *ServiceInterface) LocalDevice() spine_goapi.DeviceLocalInterface {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for LocalDevice")
}
var r0 spine_goapi.DeviceLocalInterface
if rf, ok := ret.Get(0).(func() spine_goapi.DeviceLocalInterface); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(spine_goapi.DeviceLocalInterface)
}
}
return r0
}
// ServiceInterface_LocalDevice_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LocalDevice'
type ServiceInterface_LocalDevice_Call struct {
*mock.Call
}
// LocalDevice is a helper method to define mock.On call
func (_e *ServiceInterface_Expecter) LocalDevice() *ServiceInterface_LocalDevice_Call {
return &ServiceInterface_LocalDevice_Call{Call: _e.mock.On("LocalDevice")}
}
func (_c *ServiceInterface_LocalDevice_Call) Run(run func()) *ServiceInterface_LocalDevice_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *ServiceInterface_LocalDevice_Call) Return(_a0 spine_goapi.DeviceLocalInterface) *ServiceInterface_LocalDevice_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *ServiceInterface_LocalDevice_Call) RunAndReturn(run func() spine_goapi.DeviceLocalInterface) *ServiceInterface_LocalDevice_Call {
_c.Call.Return(run)
return _c
}
// LocalService provides a mock function with given fields:
func (_m *ServiceInterface) LocalService() *ship_goapi.ServiceDetails {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for LocalService")
}
var r0 *ship_goapi.ServiceDetails
if rf, ok := ret.Get(0).(func() *ship_goapi.ServiceDetails); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ship_goapi.ServiceDetails)
}
}
return r0
}
// ServiceInterface_LocalService_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LocalService'
type ServiceInterface_LocalService_Call struct {
*mock.Call
}
// LocalService is a helper method to define mock.On call
func (_e *ServiceInterface_Expecter) LocalService() *ServiceInterface_LocalService_Call {
return &ServiceInterface_LocalService_Call{Call: _e.mock.On("LocalService")}
}
func (_c *ServiceInterface_LocalService_Call) Run(run func()) *ServiceInterface_LocalService_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *ServiceInterface_LocalService_Call) Return(_a0 *ship_goapi.ServiceDetails) *ServiceInterface_LocalService_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *ServiceInterface_LocalService_Call) RunAndReturn(run func() *ship_goapi.ServiceDetails) *ServiceInterface_LocalService_Call {
_c.Call.Return(run)
return _c
}
// PairingDetailForSki provides a mock function with given fields: ski
func (_m *ServiceInterface) PairingDetailForSki(ski string) *ship_goapi.ConnectionStateDetail {
ret := _m.Called(ski)
if len(ret) == 0 {
panic("no return value specified for PairingDetailForSki")
}
var r0 *ship_goapi.ConnectionStateDetail
if rf, ok := ret.Get(0).(func(string) *ship_goapi.ConnectionStateDetail); ok {
r0 = rf(ski)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ship_goapi.ConnectionStateDetail)
}
}
return r0
}
// ServiceInterface_PairingDetailForSki_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PairingDetailForSki'
type ServiceInterface_PairingDetailForSki_Call struct {
*mock.Call
}
// PairingDetailForSki is a helper method to define mock.On call
// - ski string
func (_e *ServiceInterface_Expecter) PairingDetailForSki(ski interface{}) *ServiceInterface_PairingDetailForSki_Call {
return &ServiceInterface_PairingDetailForSki_Call{Call: _e.mock.On("PairingDetailForSki", ski)}
}
func (_c *ServiceInterface_PairingDetailForSki_Call) Run(run func(ski string)) *ServiceInterface_PairingDetailForSki_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *ServiceInterface_PairingDetailForSki_Call) Return(_a0 *ship_goapi.ConnectionStateDetail) *ServiceInterface_PairingDetailForSki_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *ServiceInterface_PairingDetailForSki_Call) RunAndReturn(run func(string) *ship_goapi.ConnectionStateDetail) *ServiceInterface_PairingDetailForSki_Call {
_c.Call.Return(run)
return _c
}
// RegisterRemoteSKI provides a mock function with given fields: ski
func (_m *ServiceInterface) RegisterRemoteSKI(ski string) {
_m.Called(ski)
}
// ServiceInterface_RegisterRemoteSKI_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterRemoteSKI'
type ServiceInterface_RegisterRemoteSKI_Call struct {
*mock.Call
}
// RegisterRemoteSKI is a helper method to define mock.On call
// - ski string
func (_e *ServiceInterface_Expecter) RegisterRemoteSKI(ski interface{}) *ServiceInterface_RegisterRemoteSKI_Call {
return &ServiceInterface_RegisterRemoteSKI_Call{Call: _e.mock.On("RegisterRemoteSKI", ski)}
}
func (_c *ServiceInterface_RegisterRemoteSKI_Call) Run(run func(ski string)) *ServiceInterface_RegisterRemoteSKI_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *ServiceInterface_RegisterRemoteSKI_Call) Return() *ServiceInterface_RegisterRemoteSKI_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceInterface_RegisterRemoteSKI_Call) RunAndReturn(run func(string)) *ServiceInterface_RegisterRemoteSKI_Call {
_c.Call.Return(run)
return _c
}
// RemoteServiceForSKI provides a mock function with given fields: ski
func (_m *ServiceInterface) RemoteServiceForSKI(ski string) *ship_goapi.ServiceDetails {
ret := _m.Called(ski)
if len(ret) == 0 {
panic("no return value specified for RemoteServiceForSKI")
}
var r0 *ship_goapi.ServiceDetails
if rf, ok := ret.Get(0).(func(string) *ship_goapi.ServiceDetails); ok {
r0 = rf(ski)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ship_goapi.ServiceDetails)
}
}
return r0
}
// ServiceInterface_RemoteServiceForSKI_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoteServiceForSKI'
type ServiceInterface_RemoteServiceForSKI_Call struct {
*mock.Call
}
// RemoteServiceForSKI is a helper method to define mock.On call
// - ski string
func (_e *ServiceInterface_Expecter) RemoteServiceForSKI(ski interface{}) *ServiceInterface_RemoteServiceForSKI_Call {
return &ServiceInterface_RemoteServiceForSKI_Call{Call: _e.mock.On("RemoteServiceForSKI", ski)}
}
func (_c *ServiceInterface_RemoteServiceForSKI_Call) Run(run func(ski string)) *ServiceInterface_RemoteServiceForSKI_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *ServiceInterface_RemoteServiceForSKI_Call) Return(_a0 *ship_goapi.ServiceDetails) *ServiceInterface_RemoteServiceForSKI_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *ServiceInterface_RemoteServiceForSKI_Call) RunAndReturn(run func(string) *ship_goapi.ServiceDetails) *ServiceInterface_RemoteServiceForSKI_Call {
_c.Call.Return(run)
return _c
}
// 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'
type ServiceInterface_SetAutoAccept_Call struct {
*mock.Call
}
// SetAutoAccept is a helper method to define mock.On call
// - value bool
func (_e *ServiceInterface_Expecter) SetAutoAccept(value interface{}) *ServiceInterface_SetAutoAccept_Call {
return &ServiceInterface_SetAutoAccept_Call{Call: _e.mock.On("SetAutoAccept", value)}
}
func (_c *ServiceInterface_SetAutoAccept_Call) Run(run func(value bool)) *ServiceInterface_SetAutoAccept_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(bool))
})
return _c
}
func (_c *ServiceInterface_SetAutoAccept_Call) Return() *ServiceInterface_SetAutoAccept_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceInterface_SetAutoAccept_Call) RunAndReturn(run func(bool)) *ServiceInterface_SetAutoAccept_Call {
_c.Call.Return(run)
return _c
}
// 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'
type ServiceInterface_SetLogging_Call struct {
*mock.Call
}
// SetLogging is a helper method to define mock.On call
// - logger logging.LoggingInterface
func (_e *ServiceInterface_Expecter) SetLogging(logger interface{}) *ServiceInterface_SetLogging_Call {
return &ServiceInterface_SetLogging_Call{Call: _e.mock.On("SetLogging", logger)}
}
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))
})
return _c
}
func (_c *ServiceInterface_SetLogging_Call) Return() *ServiceInterface_SetLogging_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceInterface_SetLogging_Call) RunAndReturn(run func(logging.LoggingInterface)) *ServiceInterface_SetLogging_Call {
_c.Call.Return(run)
return _c
}
// Setup provides a mock function with given fields:
func (_m *ServiceInterface) Setup() error {
ret := _m.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()
} else {
r0 = ret.Error(0)
}
return r0
}
// ServiceInterface_Setup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Setup'
type ServiceInterface_Setup_Call struct {
*mock.Call
}
// Setup is a helper method to define mock.On call
func (_e *ServiceInterface_Expecter) Setup() *ServiceInterface_Setup_Call {
return &ServiceInterface_Setup_Call{Call: _e.mock.On("Setup")}
}
func (_c *ServiceInterface_Setup_Call) Run(run func()) *ServiceInterface_Setup_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *ServiceInterface_Setup_Call) Return(_a0 error) *ServiceInterface_Setup_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *ServiceInterface_Setup_Call) RunAndReturn(run func() error) *ServiceInterface_Setup_Call {
_c.Call.Return(run)
return _c
}
// Shutdown provides a mock function with given 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'
type ServiceInterface_Shutdown_Call struct {
*mock.Call
}
// Shutdown is a helper method to define mock.On call
func (_e *ServiceInterface_Expecter) Shutdown() *ServiceInterface_Shutdown_Call {
return &ServiceInterface_Shutdown_Call{Call: _e.mock.On("Shutdown")}
}
func (_c *ServiceInterface_Shutdown_Call) Run(run func()) *ServiceInterface_Shutdown_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *ServiceInterface_Shutdown_Call) Return() *ServiceInterface_Shutdown_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceInterface_Shutdown_Call) RunAndReturn(run func()) *ServiceInterface_Shutdown_Call {
_c.Call.Return(run)
return _c
}
// Start provides a mock function with given fields:
func (_m *ServiceInterface) Start() {
_m.Called()
}
// ServiceInterface_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
type ServiceInterface_Start_Call struct {
*mock.Call
}
// Start is a helper method to define mock.On call
func (_e *ServiceInterface_Expecter) Start() *ServiceInterface_Start_Call {
return &ServiceInterface_Start_Call{Call: _e.mock.On("Start")}
}
func (_c *ServiceInterface_Start_Call) Run(run func()) *ServiceInterface_Start_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *ServiceInterface_Start_Call) Return() *ServiceInterface_Start_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceInterface_Start_Call) RunAndReturn(run func()) *ServiceInterface_Start_Call {
_c.Call.Return(run)
return _c
}
// UnregisterRemoteSKI provides a mock function with given fields: ski
func (_m *ServiceInterface) UnregisterRemoteSKI(ski string) {
_m.Called(ski)
}
// ServiceInterface_UnregisterRemoteSKI_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnregisterRemoteSKI'
type ServiceInterface_UnregisterRemoteSKI_Call struct {
*mock.Call
}
// UnregisterRemoteSKI is a helper method to define mock.On call
// - ski string
func (_e *ServiceInterface_Expecter) UnregisterRemoteSKI(ski interface{}) *ServiceInterface_UnregisterRemoteSKI_Call {
return &ServiceInterface_UnregisterRemoteSKI_Call{Call: _e.mock.On("UnregisterRemoteSKI", ski)}
}
func (_c *ServiceInterface_UnregisterRemoteSKI_Call) Run(run func(ski string)) *ServiceInterface_UnregisterRemoteSKI_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *ServiceInterface_UnregisterRemoteSKI_Call) Return() *ServiceInterface_UnregisterRemoteSKI_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceInterface_UnregisterRemoteSKI_Call) RunAndReturn(run func(string)) *ServiceInterface_UnregisterRemoteSKI_Call {
_c.Call.Return(run)
return _c
}
// 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'
type ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call struct {
*mock.Call
}
// UserIsAbleToApproveOrCancelPairingRequests is a helper method to define mock.On call
// - allow bool
func (_e *ServiceInterface_Expecter) UserIsAbleToApproveOrCancelPairingRequests(allow interface{}) *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call {
return &ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call{Call: _e.mock.On("UserIsAbleToApproveOrCancelPairingRequests", allow)}
}
func (_c *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call) Run(run func(allow bool)) *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(bool))
})
return _c
}
func (_c *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call) Return() *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call) RunAndReturn(run func(bool)) *ServiceInterface_UserIsAbleToApproveOrCancelPairingRequests_Call {
_c.Call.Return(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
}
@@ -0,0 +1,207 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
api "github.com/enbility/eebus-go/api"
mock "github.com/stretchr/testify/mock"
ship_goapi "github.com/enbility/ship-go/api"
)
// ServiceReaderInterface is an autogenerated mock type for the ServiceReaderInterface type
type ServiceReaderInterface struct {
mock.Mock
}
type ServiceReaderInterface_Expecter struct {
mock *mock.Mock
}
func (_m *ServiceReaderInterface) EXPECT() *ServiceReaderInterface_Expecter {
return &ServiceReaderInterface_Expecter{mock: &_m.Mock}
}
// RemoteSKIConnected provides a mock function with given fields: service, ski
func (_m *ServiceReaderInterface) RemoteSKIConnected(service api.ServiceInterface, ski string) {
_m.Called(service, ski)
}
// ServiceReaderInterface_RemoteSKIConnected_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoteSKIConnected'
type ServiceReaderInterface_RemoteSKIConnected_Call struct {
*mock.Call
}
// RemoteSKIConnected is a helper method to define mock.On call
// - service api.ServiceInterface
// - ski string
func (_e *ServiceReaderInterface_Expecter) RemoteSKIConnected(service interface{}, ski interface{}) *ServiceReaderInterface_RemoteSKIConnected_Call {
return &ServiceReaderInterface_RemoteSKIConnected_Call{Call: _e.mock.On("RemoteSKIConnected", service, ski)}
}
func (_c *ServiceReaderInterface_RemoteSKIConnected_Call) Run(run func(service api.ServiceInterface, ski string)) *ServiceReaderInterface_RemoteSKIConnected_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(api.ServiceInterface), args[1].(string))
})
return _c
}
func (_c *ServiceReaderInterface_RemoteSKIConnected_Call) Return() *ServiceReaderInterface_RemoteSKIConnected_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceReaderInterface_RemoteSKIConnected_Call) RunAndReturn(run func(api.ServiceInterface, string)) *ServiceReaderInterface_RemoteSKIConnected_Call {
_c.Call.Return(run)
return _c
}
// RemoteSKIDisconnected provides a mock function with given fields: service, ski
func (_m *ServiceReaderInterface) RemoteSKIDisconnected(service api.ServiceInterface, ski string) {
_m.Called(service, ski)
}
// ServiceReaderInterface_RemoteSKIDisconnected_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoteSKIDisconnected'
type ServiceReaderInterface_RemoteSKIDisconnected_Call struct {
*mock.Call
}
// RemoteSKIDisconnected is a helper method to define mock.On call
// - service api.ServiceInterface
// - ski string
func (_e *ServiceReaderInterface_Expecter) RemoteSKIDisconnected(service interface{}, ski interface{}) *ServiceReaderInterface_RemoteSKIDisconnected_Call {
return &ServiceReaderInterface_RemoteSKIDisconnected_Call{Call: _e.mock.On("RemoteSKIDisconnected", service, ski)}
}
func (_c *ServiceReaderInterface_RemoteSKIDisconnected_Call) Run(run func(service api.ServiceInterface, ski string)) *ServiceReaderInterface_RemoteSKIDisconnected_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(api.ServiceInterface), args[1].(string))
})
return _c
}
func (_c *ServiceReaderInterface_RemoteSKIDisconnected_Call) Return() *ServiceReaderInterface_RemoteSKIDisconnected_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceReaderInterface_RemoteSKIDisconnected_Call) RunAndReturn(run func(api.ServiceInterface, string)) *ServiceReaderInterface_RemoteSKIDisconnected_Call {
_c.Call.Return(run)
return _c
}
// ServicePairingDetailUpdate provides a mock function with given fields: ski, detail
func (_m *ServiceReaderInterface) ServicePairingDetailUpdate(ski string, detail *ship_goapi.ConnectionStateDetail) {
_m.Called(ski, detail)
}
// ServiceReaderInterface_ServicePairingDetailUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ServicePairingDetailUpdate'
type ServiceReaderInterface_ServicePairingDetailUpdate_Call struct {
*mock.Call
}
// ServicePairingDetailUpdate is a helper method to define mock.On call
// - ski string
// - detail *ship_goapi.ConnectionStateDetail
func (_e *ServiceReaderInterface_Expecter) ServicePairingDetailUpdate(ski interface{}, detail interface{}) *ServiceReaderInterface_ServicePairingDetailUpdate_Call {
return &ServiceReaderInterface_ServicePairingDetailUpdate_Call{Call: _e.mock.On("ServicePairingDetailUpdate", ski, detail)}
}
func (_c *ServiceReaderInterface_ServicePairingDetailUpdate_Call) Run(run func(ski string, detail *ship_goapi.ConnectionStateDetail)) *ServiceReaderInterface_ServicePairingDetailUpdate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(*ship_goapi.ConnectionStateDetail))
})
return _c
}
func (_c *ServiceReaderInterface_ServicePairingDetailUpdate_Call) Return() *ServiceReaderInterface_ServicePairingDetailUpdate_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceReaderInterface_ServicePairingDetailUpdate_Call) RunAndReturn(run func(string, *ship_goapi.ConnectionStateDetail)) *ServiceReaderInterface_ServicePairingDetailUpdate_Call {
_c.Call.Return(run)
return _c
}
// ServiceShipIDUpdate provides a mock function with given fields: ski, shipdID
func (_m *ServiceReaderInterface) ServiceShipIDUpdate(ski string, shipdID string) {
_m.Called(ski, shipdID)
}
// ServiceReaderInterface_ServiceShipIDUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ServiceShipIDUpdate'
type ServiceReaderInterface_ServiceShipIDUpdate_Call struct {
*mock.Call
}
// ServiceShipIDUpdate is a helper method to define mock.On call
// - ski string
// - shipdID string
func (_e *ServiceReaderInterface_Expecter) ServiceShipIDUpdate(ski interface{}, shipdID interface{}) *ServiceReaderInterface_ServiceShipIDUpdate_Call {
return &ServiceReaderInterface_ServiceShipIDUpdate_Call{Call: _e.mock.On("ServiceShipIDUpdate", ski, shipdID)}
}
func (_c *ServiceReaderInterface_ServiceShipIDUpdate_Call) Run(run func(ski string, shipdID string)) *ServiceReaderInterface_ServiceShipIDUpdate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string))
})
return _c
}
func (_c *ServiceReaderInterface_ServiceShipIDUpdate_Call) Return() *ServiceReaderInterface_ServiceShipIDUpdate_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceReaderInterface_ServiceShipIDUpdate_Call) RunAndReturn(run func(string, string)) *ServiceReaderInterface_ServiceShipIDUpdate_Call {
_c.Call.Return(run)
return _c
}
// VisibleRemoteServicesUpdated provides a mock function with given fields: service, entries
func (_m *ServiceReaderInterface) VisibleRemoteServicesUpdated(service api.ServiceInterface, entries []ship_goapi.RemoteService) {
_m.Called(service, entries)
}
// ServiceReaderInterface_VisibleRemoteServicesUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VisibleRemoteServicesUpdated'
type ServiceReaderInterface_VisibleRemoteServicesUpdated_Call struct {
*mock.Call
}
// VisibleRemoteServicesUpdated is a helper method to define mock.On call
// - service api.ServiceInterface
// - entries []ship_goapi.RemoteService
func (_e *ServiceReaderInterface_Expecter) VisibleRemoteServicesUpdated(service interface{}, entries interface{}) *ServiceReaderInterface_VisibleRemoteServicesUpdated_Call {
return &ServiceReaderInterface_VisibleRemoteServicesUpdated_Call{Call: _e.mock.On("VisibleRemoteServicesUpdated", service, entries)}
}
func (_c *ServiceReaderInterface_VisibleRemoteServicesUpdated_Call) Run(run func(service api.ServiceInterface, entries []ship_goapi.RemoteService)) *ServiceReaderInterface_VisibleRemoteServicesUpdated_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(api.ServiceInterface), args[1].([]ship_goapi.RemoteService))
})
return _c
}
func (_c *ServiceReaderInterface_VisibleRemoteServicesUpdated_Call) Return() *ServiceReaderInterface_VisibleRemoteServicesUpdated_Call {
_c.Call.Return()
return _c
}
func (_c *ServiceReaderInterface_VisibleRemoteServicesUpdated_Call) RunAndReturn(run func(api.ServiceInterface, []ship_goapi.RemoteService)) *ServiceReaderInterface_VisibleRemoteServicesUpdated_Call {
_c.Call.Return(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
}
@@ -0,0 +1,150 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// SmartEnergyManagementPsClientInterface is an autogenerated mock type for the SmartEnergyManagementPsClientInterface type
type SmartEnergyManagementPsClientInterface struct {
mock.Mock
}
type SmartEnergyManagementPsClientInterface_Expecter struct {
mock *mock.Mock
}
func (_m *SmartEnergyManagementPsClientInterface) EXPECT() *SmartEnergyManagementPsClientInterface_Expecter {
return &SmartEnergyManagementPsClientInterface_Expecter{mock: &_m.Mock}
}
// RequestData provides a mock function with given fields:
func (_m *SmartEnergyManagementPsClientInterface) RequestData() (*model.MsgCounterType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RequestData")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.MsgCounterType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SmartEnergyManagementPsClientInterface_RequestData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestData'
type SmartEnergyManagementPsClientInterface_RequestData_Call struct {
*mock.Call
}
// RequestData is a helper method to define mock.On call
func (_e *SmartEnergyManagementPsClientInterface_Expecter) RequestData() *SmartEnergyManagementPsClientInterface_RequestData_Call {
return &SmartEnergyManagementPsClientInterface_RequestData_Call{Call: _e.mock.On("RequestData")}
}
func (_c *SmartEnergyManagementPsClientInterface_RequestData_Call) Run(run func()) *SmartEnergyManagementPsClientInterface_RequestData_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *SmartEnergyManagementPsClientInterface_RequestData_Call) Return(_a0 *model.MsgCounterType, _a1 error) *SmartEnergyManagementPsClientInterface_RequestData_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *SmartEnergyManagementPsClientInterface_RequestData_Call) RunAndReturn(run func() (*model.MsgCounterType, error)) *SmartEnergyManagementPsClientInterface_RequestData_Call {
_c.Call.Return(run)
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)
if len(ret) == 0 {
panic("no return value specified for WriteData")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func(*model.SmartEnergyManagementPsDataType) (*model.MsgCounterType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(*model.SmartEnergyManagementPsDataType) error); ok {
r1 = rf(data)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SmartEnergyManagementPsClientInterface_WriteData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteData'
type SmartEnergyManagementPsClientInterface_WriteData_Call struct {
*mock.Call
}
// WriteData is a helper method to define mock.On call
// - data *model.SmartEnergyManagementPsDataType
func (_e *SmartEnergyManagementPsClientInterface_Expecter) WriteData(data interface{}) *SmartEnergyManagementPsClientInterface_WriteData_Call {
return &SmartEnergyManagementPsClientInterface_WriteData_Call{Call: _e.mock.On("WriteData", data)}
}
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))
})
return _c
}
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(*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
}
@@ -0,0 +1,92 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// SmartEnergyManagementPsCommonInterface is an autogenerated mock type for the SmartEnergyManagementPsCommonInterface type
type SmartEnergyManagementPsCommonInterface struct {
mock.Mock
}
type SmartEnergyManagementPsCommonInterface_Expecter struct {
mock *mock.Mock
}
func (_m *SmartEnergyManagementPsCommonInterface) EXPECT() *SmartEnergyManagementPsCommonInterface_Expecter {
return &SmartEnergyManagementPsCommonInterface_Expecter{mock: &_m.Mock}
}
// GetData provides a mock function with given fields:
func (_m *SmartEnergyManagementPsCommonInterface) GetData() (*model.SmartEnergyManagementPsDataType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetData")
}
var r0 *model.SmartEnergyManagementPsDataType
var r1 error
if rf, ok := ret.Get(0).(func() (*model.SmartEnergyManagementPsDataType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SmartEnergyManagementPsCommonInterface_GetData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetData'
type SmartEnergyManagementPsCommonInterface_GetData_Call struct {
*mock.Call
}
// GetData is a helper method to define mock.On call
func (_e *SmartEnergyManagementPsCommonInterface_Expecter) GetData() *SmartEnergyManagementPsCommonInterface_GetData_Call {
return &SmartEnergyManagementPsCommonInterface_GetData_Call{Call: _e.mock.On("GetData")}
}
func (_c *SmartEnergyManagementPsCommonInterface_GetData_Call) Run(run func()) *SmartEnergyManagementPsCommonInterface_GetData_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *SmartEnergyManagementPsCommonInterface_GetData_Call) Return(_a0 *model.SmartEnergyManagementPsDataType, _a1 error) *SmartEnergyManagementPsCommonInterface_GetData_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *SmartEnergyManagementPsCommonInterface_GetData_Call) RunAndReturn(run func() (*model.SmartEnergyManagementPsDataType, error)) *SmartEnergyManagementPsCommonInterface_GetData_Call {
_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
}
@@ -0,0 +1,32 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
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}
}
// 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.
func NewSmartEnergyManagementPsServerInterface(t interface {
mock.TestingT
Cleanup(func())
}) *SmartEnergyManagementPsServerInterface {
mock := &SmartEnergyManagementPsServerInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,270 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// TimeSeriesClientInterface is an autogenerated mock type for the TimeSeriesClientInterface type
type TimeSeriesClientInterface struct {
mock.Mock
}
type TimeSeriesClientInterface_Expecter struct {
mock *mock.Mock
}
func (_m *TimeSeriesClientInterface) EXPECT() *TimeSeriesClientInterface_Expecter {
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)
if len(ret) == 0 {
panic("no return value specified for RequestConstraints")
}
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 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 rf, ok := ret.Get(1).(func(*model.TimeSeriesConstraintsListDataSelectorsType, *model.TimeSeriesConstraintsDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TimeSeriesClientInterface_RequestConstraints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestConstraints'
type TimeSeriesClientInterface_RequestConstraints_Call struct {
*mock.Call
}
// RequestConstraints is a helper method to define mock.On call
// - selector *model.TimeSeriesConstraintsListDataSelectorsType
// - elements *model.TimeSeriesConstraintsDataElementsType
func (_e *TimeSeriesClientInterface_Expecter) RequestConstraints(selector interface{}, elements interface{}) *TimeSeriesClientInterface_RequestConstraints_Call {
return &TimeSeriesClientInterface_RequestConstraints_Call{Call: _e.mock.On("RequestConstraints", selector, elements)}
}
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))
})
return _c
}
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(*model.TimeSeriesConstraintsListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for RequestData")
}
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 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 rf, ok := ret.Get(1).(func(*model.TimeSeriesListDataSelectorsType, *model.TimeSeriesDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TimeSeriesClientInterface_RequestData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestData'
type TimeSeriesClientInterface_RequestData_Call struct {
*mock.Call
}
// RequestData is a helper method to define mock.On call
// - selector *model.TimeSeriesListDataSelectorsType
// - elements *model.TimeSeriesDataElementsType
func (_e *TimeSeriesClientInterface_Expecter) RequestData(selector interface{}, elements interface{}) *TimeSeriesClientInterface_RequestData_Call {
return &TimeSeriesClientInterface_RequestData_Call{Call: _e.mock.On("RequestData", selector, elements)}
}
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))
})
return _c
}
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(*model.TimeSeriesListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for RequestDescriptions")
}
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 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 rf, ok := ret.Get(1).(func(*model.TimeSeriesDescriptionListDataSelectorsType, *model.TimeSeriesDescriptionDataElementsType) error); ok {
r1 = rf(selector, elements)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TimeSeriesClientInterface_RequestDescriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RequestDescriptions'
type TimeSeriesClientInterface_RequestDescriptions_Call struct {
*mock.Call
}
// RequestDescriptions is a helper method to define mock.On call
// - selector *model.TimeSeriesDescriptionListDataSelectorsType
// - elements *model.TimeSeriesDescriptionDataElementsType
func (_e *TimeSeriesClientInterface_Expecter) RequestDescriptions(selector interface{}, elements interface{}) *TimeSeriesClientInterface_RequestDescriptions_Call {
return &TimeSeriesClientInterface_RequestDescriptions_Call{Call: _e.mock.On("RequestDescriptions", selector, elements)}
}
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))
})
return _c
}
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(*model.TimeSeriesDescriptionListDataSelectorsType, *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)
if len(ret) == 0 {
panic("no return value specified for WriteData")
}
var r0 *model.MsgCounterType
var r1 error
if rf, ok := ret.Get(0).(func([]model.TimeSeriesDataType) (*model.MsgCounterType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func([]model.TimeSeriesDataType) error); ok {
r1 = rf(data)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TimeSeriesClientInterface_WriteData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteData'
type TimeSeriesClientInterface_WriteData_Call struct {
*mock.Call
}
// WriteData is a helper method to define mock.On call
// - data []model.TimeSeriesDataType
func (_e *TimeSeriesClientInterface_Expecter) WriteData(data interface{}) *TimeSeriesClientInterface_WriteData_Call {
return &TimeSeriesClientInterface_WriteData_Call{Call: _e.mock.On("WriteData", data)}
}
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))
})
return _c
}
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([]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
}
@@ -0,0 +1,208 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
model "github.com/enbility/spine-go/model"
mock "github.com/stretchr/testify/mock"
)
// TimeSeriesCommonInterface is an autogenerated mock type for the TimeSeriesCommonInterface type
type TimeSeriesCommonInterface struct {
mock.Mock
}
type TimeSeriesCommonInterface_Expecter struct {
mock *mock.Mock
}
func (_m *TimeSeriesCommonInterface) EXPECT() *TimeSeriesCommonInterface_Expecter {
return &TimeSeriesCommonInterface_Expecter{mock: &_m.Mock}
}
// GetConstraints provides a mock function with given fields:
func (_m *TimeSeriesCommonInterface) GetConstraints() ([]model.TimeSeriesConstraintsDataType, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for GetConstraints")
}
var r0 []model.TimeSeriesConstraintsDataType
var r1 error
if rf, ok := ret.Get(0).(func() ([]model.TimeSeriesConstraintsDataType, error)); ok {
return rf()
}
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 rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TimeSeriesCommonInterface_GetConstraints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConstraints'
type TimeSeriesCommonInterface_GetConstraints_Call struct {
*mock.Call
}
// GetConstraints is a helper method to define mock.On call
func (_e *TimeSeriesCommonInterface_Expecter) GetConstraints() *TimeSeriesCommonInterface_GetConstraints_Call {
return &TimeSeriesCommonInterface_GetConstraints_Call{Call: _e.mock.On("GetConstraints")}
}
func (_c *TimeSeriesCommonInterface_GetConstraints_Call) Run(run func()) *TimeSeriesCommonInterface_GetConstraints_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *TimeSeriesCommonInterface_GetConstraints_Call) Return(_a0 []model.TimeSeriesConstraintsDataType, _a1 error) *TimeSeriesCommonInterface_GetConstraints_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *TimeSeriesCommonInterface_GetConstraints_Call) RunAndReturn(run func() ([]model.TimeSeriesConstraintsDataType, error)) *TimeSeriesCommonInterface_GetConstraints_Call {
_c.Call.Return(run)
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)
if len(ret) == 0 {
panic("no return value specified for GetDataForFilter")
}
var r0 []model.TimeSeriesDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.TimeSeriesDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TimeSeriesCommonInterface_GetDataForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDataForFilter'
type TimeSeriesCommonInterface_GetDataForFilter_Call struct {
*mock.Call
}
// GetDataForFilter is a helper method to define mock.On call
// - filter model.TimeSeriesDescriptionDataType
func (_e *TimeSeriesCommonInterface_Expecter) GetDataForFilter(filter interface{}) *TimeSeriesCommonInterface_GetDataForFilter_Call {
return &TimeSeriesCommonInterface_GetDataForFilter_Call{Call: _e.mock.On("GetDataForFilter", filter)}
}
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))
})
return _c
}
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(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)
if len(ret) == 0 {
panic("no return value specified for GetDescriptionsForFilter")
}
var r0 []model.TimeSeriesDescriptionDataType
var r1 error
if rf, ok := ret.Get(0).(func(model.TimeSeriesDescriptionDataType) ([]model.TimeSeriesDescriptionDataType, error)); ok {
return rf(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 rf, ok := ret.Get(1).(func(model.TimeSeriesDescriptionDataType) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TimeSeriesCommonInterface_GetDescriptionsForFilter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDescriptionsForFilter'
type TimeSeriesCommonInterface_GetDescriptionsForFilter_Call struct {
*mock.Call
}
// GetDescriptionsForFilter is a helper method to define mock.On call
// - filter model.TimeSeriesDescriptionDataType
func (_e *TimeSeriesCommonInterface_Expecter) GetDescriptionsForFilter(filter interface{}) *TimeSeriesCommonInterface_GetDescriptionsForFilter_Call {
return &TimeSeriesCommonInterface_GetDescriptionsForFilter_Call{Call: _e.mock.On("GetDescriptionsForFilter", filter)}
}
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))
})
return _c
}
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(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
}
@@ -0,0 +1,32 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
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}
}
// 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.
func NewTimeSeriesServerInterface(t interface {
mock.TestingT
Cleanup(func())
}) *TimeSeriesServerInterface {
mock := &TimeSeriesServerInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,322 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
api "github.com/enbility/eebus-go/api"
mock "github.com/stretchr/testify/mock"
spine_goapi "github.com/enbility/spine-go/api"
)
// UseCaseBaseInterface is an autogenerated mock type for the UseCaseBaseInterface type
type UseCaseBaseInterface struct {
mock.Mock
}
type UseCaseBaseInterface_Expecter struct {
mock *mock.Mock
}
func (_m *UseCaseBaseInterface) EXPECT() *UseCaseBaseInterface_Expecter {
return &UseCaseBaseInterface_Expecter{mock: &_m.Mock}
}
// AddUseCase provides a mock function with given 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'
type UseCaseBaseInterface_AddUseCase_Call struct {
*mock.Call
}
// AddUseCase is a helper method to define mock.On call
func (_e *UseCaseBaseInterface_Expecter) AddUseCase() *UseCaseBaseInterface_AddUseCase_Call {
return &UseCaseBaseInterface_AddUseCase_Call{Call: _e.mock.On("AddUseCase")}
}
func (_c *UseCaseBaseInterface_AddUseCase_Call) Run(run func()) *UseCaseBaseInterface_AddUseCase_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *UseCaseBaseInterface_AddUseCase_Call) Return() *UseCaseBaseInterface_AddUseCase_Call {
_c.Call.Return()
return _c
}
func (_c *UseCaseBaseInterface_AddUseCase_Call) RunAndReturn(run func()) *UseCaseBaseInterface_AddUseCase_Call {
_c.Call.Return(run)
return _c
}
// 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 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
}
// UseCaseBaseInterface_AvailableScenariosForEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AvailableScenariosForEntity'
type UseCaseBaseInterface_AvailableScenariosForEntity_Call struct {
*mock.Call
}
// AvailableScenariosForEntity is a helper method to define mock.On call
// - 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 spine_goapi.EntityRemoteInterface)) *UseCaseBaseInterface_AvailableScenariosForEntity_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(spine_goapi.EntityRemoteInterface))
})
return _c
}
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(spine_goapi.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)
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
}
// UseCaseBaseInterface_IsCompatibleEntityType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsCompatibleEntityType'
type UseCaseBaseInterface_IsCompatibleEntityType_Call struct {
*mock.Call
}
// IsCompatibleEntityType is a helper method to define mock.On call
// - 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 spine_goapi.EntityRemoteInterface)) *UseCaseBaseInterface_IsCompatibleEntityType_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(spine_goapi.EntityRemoteInterface))
})
return _c
}
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(spine_goapi.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)
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
}
// UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsScenarioAvailableAtEntity'
type UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call struct {
*mock.Call
}
// IsScenarioAvailableAtEntity is a helper method to define mock.On call
// - 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 spine_goapi.EntityRemoteInterface, scenario uint)) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint))
})
return _c
}
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(spine_goapi.EntityRemoteInterface, uint) bool) *UseCaseBaseInterface_IsScenarioAvailableAtEntity_Call {
_c.Call.Return(run)
return _c
}
// RemoteEntitiesScenarios provides a mock function with given fields:
func (_m *UseCaseBaseInterface) RemoteEntitiesScenarios() []api.RemoteEntityScenarios {
ret := _m.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()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]api.RemoteEntityScenarios)
}
}
return r0
}
// UseCaseBaseInterface_RemoteEntitiesScenarios_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoteEntitiesScenarios'
type UseCaseBaseInterface_RemoteEntitiesScenarios_Call struct {
*mock.Call
}
// RemoteEntitiesScenarios is a helper method to define mock.On call
func (_e *UseCaseBaseInterface_Expecter) RemoteEntitiesScenarios() *UseCaseBaseInterface_RemoteEntitiesScenarios_Call {
return &UseCaseBaseInterface_RemoteEntitiesScenarios_Call{Call: _e.mock.On("RemoteEntitiesScenarios")}
}
func (_c *UseCaseBaseInterface_RemoteEntitiesScenarios_Call) Run(run func()) *UseCaseBaseInterface_RemoteEntitiesScenarios_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
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() []api.RemoteEntityScenarios) *UseCaseBaseInterface_RemoteEntitiesScenarios_Call {
_c.Call.Return(run)
return _c
}
// RemoveUseCase provides a mock function with given 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'
type UseCaseBaseInterface_RemoveUseCase_Call struct {
*mock.Call
}
// RemoveUseCase is a helper method to define mock.On call
func (_e *UseCaseBaseInterface_Expecter) RemoveUseCase() *UseCaseBaseInterface_RemoveUseCase_Call {
return &UseCaseBaseInterface_RemoveUseCase_Call{Call: _e.mock.On("RemoveUseCase")}
}
func (_c *UseCaseBaseInterface_RemoveUseCase_Call) Run(run func()) *UseCaseBaseInterface_RemoveUseCase_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *UseCaseBaseInterface_RemoveUseCase_Call) Return() *UseCaseBaseInterface_RemoveUseCase_Call {
_c.Call.Return()
return _c
}
func (_c *UseCaseBaseInterface_RemoveUseCase_Call) RunAndReturn(run func()) *UseCaseBaseInterface_RemoveUseCase_Call {
_c.Call.Return(run)
return _c
}
// 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'
type UseCaseBaseInterface_UpdateUseCaseAvailability_Call struct {
*mock.Call
}
// UpdateUseCaseAvailability is a helper method to define mock.On call
// - available bool
func (_e *UseCaseBaseInterface_Expecter) UpdateUseCaseAvailability(available interface{}) *UseCaseBaseInterface_UpdateUseCaseAvailability_Call {
return &UseCaseBaseInterface_UpdateUseCaseAvailability_Call{Call: _e.mock.On("UpdateUseCaseAvailability", available)}
}
func (_c *UseCaseBaseInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *UseCaseBaseInterface_UpdateUseCaseAvailability_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(bool))
})
return _c
}
func (_c *UseCaseBaseInterface_UpdateUseCaseAvailability_Call) Return() *UseCaseBaseInterface_UpdateUseCaseAvailability_Call {
_c.Call.Return()
return _c
}
func (_c *UseCaseBaseInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *UseCaseBaseInterface_UpdateUseCaseAvailability_Call {
_c.Call.Return(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
}
@@ -0,0 +1,354 @@
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
api "github.com/enbility/eebus-go/api"
mock "github.com/stretchr/testify/mock"
spine_goapi "github.com/enbility/spine-go/api"
)
// UseCaseInterface is an autogenerated mock type for the UseCaseInterface type
type UseCaseInterface struct {
mock.Mock
}
type UseCaseInterface_Expecter struct {
mock *mock.Mock
}
func (_m *UseCaseInterface) EXPECT() *UseCaseInterface_Expecter {
return &UseCaseInterface_Expecter{mock: &_m.Mock}
}
// AddFeatures provides a mock function with given fields:
func (_m *UseCaseInterface) AddFeatures() {
_m.Called()
}
// UseCaseInterface_AddFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFeatures'
type UseCaseInterface_AddFeatures_Call struct {
*mock.Call
}
// AddFeatures is a helper method to define mock.On call
func (_e *UseCaseInterface_Expecter) AddFeatures() *UseCaseInterface_AddFeatures_Call {
return &UseCaseInterface_AddFeatures_Call{Call: _e.mock.On("AddFeatures")}
}
func (_c *UseCaseInterface_AddFeatures_Call) Run(run func()) *UseCaseInterface_AddFeatures_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *UseCaseInterface_AddFeatures_Call) Return() *UseCaseInterface_AddFeatures_Call {
_c.Call.Return()
return _c
}
func (_c *UseCaseInterface_AddFeatures_Call) RunAndReturn(run func()) *UseCaseInterface_AddFeatures_Call {
_c.Call.Return(run)
return _c
}
// AddUseCase provides a mock function with given 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'
type UseCaseInterface_AddUseCase_Call struct {
*mock.Call
}
// AddUseCase is a helper method to define mock.On call
func (_e *UseCaseInterface_Expecter) AddUseCase() *UseCaseInterface_AddUseCase_Call {
return &UseCaseInterface_AddUseCase_Call{Call: _e.mock.On("AddUseCase")}
}
func (_c *UseCaseInterface_AddUseCase_Call) Run(run func()) *UseCaseInterface_AddUseCase_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *UseCaseInterface_AddUseCase_Call) Return() *UseCaseInterface_AddUseCase_Call {
_c.Call.Return()
return _c
}
func (_c *UseCaseInterface_AddUseCase_Call) RunAndReturn(run func()) *UseCaseInterface_AddUseCase_Call {
_c.Call.Return(run)
return _c
}
// 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 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
}
// UseCaseInterface_AvailableScenariosForEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AvailableScenariosForEntity'
type UseCaseInterface_AvailableScenariosForEntity_Call struct {
*mock.Call
}
// AvailableScenariosForEntity is a helper method to define mock.On call
// - 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 spine_goapi.EntityRemoteInterface)) *UseCaseInterface_AvailableScenariosForEntity_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(spine_goapi.EntityRemoteInterface))
})
return _c
}
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(spine_goapi.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)
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
}
// UseCaseInterface_IsCompatibleEntityType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsCompatibleEntityType'
type UseCaseInterface_IsCompatibleEntityType_Call struct {
*mock.Call
}
// IsCompatibleEntityType is a helper method to define mock.On call
// - 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 spine_goapi.EntityRemoteInterface)) *UseCaseInterface_IsCompatibleEntityType_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(spine_goapi.EntityRemoteInterface))
})
return _c
}
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(spine_goapi.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)
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
}
// UseCaseInterface_IsScenarioAvailableAtEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsScenarioAvailableAtEntity'
type UseCaseInterface_IsScenarioAvailableAtEntity_Call struct {
*mock.Call
}
// IsScenarioAvailableAtEntity is a helper method to define mock.On call
// - 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 spine_goapi.EntityRemoteInterface, scenario uint)) *UseCaseInterface_IsScenarioAvailableAtEntity_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(spine_goapi.EntityRemoteInterface), args[1].(uint))
})
return _c
}
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(spine_goapi.EntityRemoteInterface, uint) bool) *UseCaseInterface_IsScenarioAvailableAtEntity_Call {
_c.Call.Return(run)
return _c
}
// RemoteEntitiesScenarios provides a mock function with given fields:
func (_m *UseCaseInterface) RemoteEntitiesScenarios() []api.RemoteEntityScenarios {
ret := _m.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()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]api.RemoteEntityScenarios)
}
}
return r0
}
// UseCaseInterface_RemoteEntitiesScenarios_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoteEntitiesScenarios'
type UseCaseInterface_RemoteEntitiesScenarios_Call struct {
*mock.Call
}
// RemoteEntitiesScenarios is a helper method to define mock.On call
func (_e *UseCaseInterface_Expecter) RemoteEntitiesScenarios() *UseCaseInterface_RemoteEntitiesScenarios_Call {
return &UseCaseInterface_RemoteEntitiesScenarios_Call{Call: _e.mock.On("RemoteEntitiesScenarios")}
}
func (_c *UseCaseInterface_RemoteEntitiesScenarios_Call) Run(run func()) *UseCaseInterface_RemoteEntitiesScenarios_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
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() []api.RemoteEntityScenarios) *UseCaseInterface_RemoteEntitiesScenarios_Call {
_c.Call.Return(run)
return _c
}
// RemoveUseCase provides a mock function with given 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'
type UseCaseInterface_RemoveUseCase_Call struct {
*mock.Call
}
// RemoveUseCase is a helper method to define mock.On call
func (_e *UseCaseInterface_Expecter) RemoveUseCase() *UseCaseInterface_RemoveUseCase_Call {
return &UseCaseInterface_RemoveUseCase_Call{Call: _e.mock.On("RemoveUseCase")}
}
func (_c *UseCaseInterface_RemoveUseCase_Call) Run(run func()) *UseCaseInterface_RemoveUseCase_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *UseCaseInterface_RemoveUseCase_Call) Return() *UseCaseInterface_RemoveUseCase_Call {
_c.Call.Return()
return _c
}
func (_c *UseCaseInterface_RemoveUseCase_Call) RunAndReturn(run func()) *UseCaseInterface_RemoveUseCase_Call {
_c.Call.Return(run)
return _c
}
// 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'
type UseCaseInterface_UpdateUseCaseAvailability_Call struct {
*mock.Call
}
// UpdateUseCaseAvailability is a helper method to define mock.On call
// - available bool
func (_e *UseCaseInterface_Expecter) UpdateUseCaseAvailability(available interface{}) *UseCaseInterface_UpdateUseCaseAvailability_Call {
return &UseCaseInterface_UpdateUseCaseAvailability_Call{Call: _e.mock.On("UpdateUseCaseAvailability", available)}
}
func (_c *UseCaseInterface_UpdateUseCaseAvailability_Call) Run(run func(available bool)) *UseCaseInterface_UpdateUseCaseAvailability_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(bool))
})
return _c
}
func (_c *UseCaseInterface_UpdateUseCaseAvailability_Call) Return() *UseCaseInterface_UpdateUseCaseAvailability_Call {
_c.Call.Return()
return _c
}
func (_c *UseCaseInterface_UpdateUseCaseAvailability_Call) RunAndReturn(run func(bool)) *UseCaseInterface_UpdateUseCaseAvailability_Call {
_c.Call.Return(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
}
+244
View File
@@ -0,0 +1,244 @@
package service
import (
"crypto/x509"
"errors"
"fmt"
"strconv"
"sync"
"github.com/enbility/eebus-go/api"
shipapi "github.com/enbility/ship-go/api"
"github.com/enbility/ship-go/cert"
"github.com/enbility/ship-go/hub"
"github.com/enbility/ship-go/logging"
"github.com/enbility/ship-go/mdns"
spineapi "github.com/enbility/spine-go/api"
"github.com/enbility/spine-go/model"
"github.com/enbility/spine-go/spine"
)
// A service is the central element of an EEBUS service
// including its websocket server and a zeroconf service.
type Service struct {
configuration *api.Configuration
// The local service details
localService *shipapi.ServiceDetails
// Connection Registrations
connectionsHub shipapi.HubInterface
// The SPINE specific device definition
spineLocalDevice spineapi.DeviceLocalInterface
serviceHandler api.ServiceReaderInterface
usecases []api.UseCaseInterface
// defines wether a user interaction to accept pairing is possible
isPairingPossible bool
startOnce sync.Once
mux sync.Mutex
}
// creates a new EEBUS service
func NewService(configuration *api.Configuration, serviceHandler api.ServiceReaderInterface) *Service {
return &Service{
configuration: configuration,
serviceHandler: serviceHandler,
}
}
var _ api.ServiceInterface = (*Service)(nil)
// Starts the service by initializeing mDNS and the server.
func (s *Service) Setup() error {
sd := s.configuration
if len(sd.Certificate().Certificate) == 0 {
return errors.New("missing certificate")
}
leaf, err := x509.ParseCertificate(sd.Certificate().Certificate[0])
if err != nil {
return err
}
ski, err := cert.SkiFromCertificate(leaf)
if err != nil {
return err
}
// Initialize the local service
// The ShipID is defined in SHIP Spec 3. as
// Each SHIP node has a globally unique SHIP ID. The SHIP ID is used to uniquely identify a SHIP node,
// e.g. in its service discovery. This ID is present in the mDNS/DNS-SD local service discovery;
// In SHIP 13.4.6.2 the accessMethods.id is defined as
// The originator's unique ID
// I assume those two to mean the same.
// TODO: clarify
s.localService = shipapi.NewServiceDetails(ski)
s.localService.SetShipID(sd.Identifier())
s.localService.SetDeviceType(string(sd.DeviceType()))
logging.Log().Info("Local SKI:", ski)
vendor := sd.VendorCode()
if vendor == "" {
vendor = sd.DeviceBrand()
}
serial := sd.DeviceSerialNumber()
if serial != "" {
serial = fmt.Sprintf("-%s", serial)
}
// Create the SPINE device address, according to Protocol Specification 7.1.1.2
var deviceAddress string
vendorType := "i"
if _, err := strconv.Atoi(vendor); err != nil {
vendorType = "n"
}
deviceAddress = fmt.Sprintf("d:_%s:%s_%s%s", vendorType, vendor, sd.DeviceModel(), serial)
if len(deviceAddress) > 256 {
return fmt.Errorf("generated device address may not be longer than 256 characters: %s", deviceAddress)
}
// Create the local SPINE device
s.spineLocalDevice = spine.NewDeviceLocal(
sd.DeviceBrand(),
sd.DeviceModel(),
sd.DeviceSerialNumber(),
sd.Identifier(),
deviceAddress,
sd.DeviceType(),
sd.FeatureSet(),
)
// Create the device entities and add it to the SPINE device
for _, entityType := range sd.EntityTypes() {
entityAddressId := model.AddressEntityType(len(s.spineLocalDevice.Entities()))
entityAddress := []model.AddressEntityType{entityAddressId}
entity := spine.NewEntityLocal(s.spineLocalDevice, entityType, entityAddress, sd.HeartbeatTimeout())
s.spineLocalDevice.AddEntity(entity)
}
// setup mDNS
mdns := mdns.NewMDNS(
s.localService.SKI(),
sd.DeviceBrand(),
sd.DeviceModel(),
string(sd.DeviceType()),
sd.Identifier(),
sd.MdnsServiceName(),
sd.Port(),
sd.Interfaces(),
sd.MdnsProviderSelection(),
)
// Setup connections hub with mDNS and websocket connection handling
s.connectionsHub = hub.NewHub(s, mdns, s.configuration.Port(), s.configuration.Certificate(), s.localService)
return nil
}
// Starts the service
func (s *Service) Start() {
s.startOnce.Do(func() {
s.connectionsHub.Start()
})
}
// Shutdown all services and stop the server.
func (s *Service) Shutdown() {
// Shut down all running connections
s.connectionsHub.Shutdown()
}
// add a use case to the service
func (s *Service) AddUseCase(useCase api.UseCaseInterface) {
s.usecases = append(s.usecases, useCase)
useCase.AddFeatures()
useCase.AddUseCase()
}
func (s *Service) Configuration() *api.Configuration {
return s.configuration
}
func (s *Service) LocalService() *shipapi.ServiceDetails {
return s.localService
}
func (s *Service) LocalDevice() spineapi.DeviceLocalInterface {
return s.spineLocalDevice
}
// Sets a custom logging implementation
// By default NoLogging is used, so no logs are printed
func (s *Service) SetLogging(logger logging.LoggingInterface) {
if logger == nil {
return
}
logging.SetLogging(logger)
}
// Get the current pairing details for a given SKI
func (s *Service) PairingDetailForSki(ski string) *shipapi.ConnectionStateDetail {
return s.connectionsHub.PairingDetailForSki(ski)
}
// Returns the Service detail of a given remote SKI
func (s *Service) RemoteServiceForSKI(ski string) *shipapi.ServiceDetails {
return s.connectionsHub.ServiceForSKI(ski)
}
func (s *Service) SetAutoAccept(value bool) {
s.localService.SetAutoAccept(value)
s.connectionsHub.SetAutoAccept(value)
}
func (s *Service) IsAutoAcceptEnabled() bool {
return s.localService.AutoAccept()
}
// Sets the SKI as being paired
// and connect it if paired and not currently being connected
func (s *Service) RegisterRemoteSKI(ski string) {
s.connectionsHub.RegisterRemoteSKI(ski)
}
// Sets the SKI as not being paired
// and disconnects it if connected
func (s *Service) UnregisterRemoteSKI(ski string) {
s.connectionsHub.UnregisterRemoteSKI(ski)
}
// Close a connection to a remote SKI
func (s *Service) DisconnectSKI(ski string, reason string) {
s.connectionsHub.DisconnectSKI(ski, reason)
}
// Cancels the pairing process for a SKI
func (s *Service) CancelPairingWithSKI(ski string) {
s.connectionsHub.CancelPairingWithSKI(ski)
}
// Define wether the user is able to react to an incoming pairing request
//
// Call this with `true` e.g. if the user is currently using a web interface
// where an incoming request can be accepted or denied
//
// Default is set to false, meaning every incoming pairing request will be
// automatically denied
func (s *Service) UserIsAbleToApproveOrCancelPairingRequests(allow bool) {
s.mux.Lock()
defer s.mux.Unlock()
s.isPairingPossible = allow
}
@@ -0,0 +1,53 @@
package service
import (
shipapi "github.com/enbility/ship-go/api"
)
var _ shipapi.HubReaderInterface = (*Service)(nil)
// report a connection to a SKI
func (s *Service) RemoteSKIConnected(ski string) {
s.serviceHandler.RemoteSKIConnected(s, ski)
}
// report a disconnection to a SKI
func (s *Service) RemoteSKIDisconnected(ski string) {
if s.spineLocalDevice != nil {
s.spineLocalDevice.RemoveRemoteDeviceConnection(ski)
}
s.serviceHandler.RemoteSKIDisconnected(s, ski)
}
// report an approved handshake by a remote device
func (s *Service) SetupRemoteDevice(ski string, writeI shipapi.ShipConnectionDataWriterInterface) shipapi.ShipConnectionDataReaderInterface {
return s.LocalDevice().SetupRemoteDevice(ski, writeI)
}
// report all currently visible EEBUS services
func (s *Service) VisibleRemoteServicesUpdated(entries []shipapi.RemoteService) {
s.serviceHandler.VisibleRemoteServicesUpdated(s, entries)
}
// Provides the SHIP ID the remote service reported during the handshake process
// This needs to be persisted and passed on for future remote service connections
// when using `PairRemoteService`
func (s *Service) ServiceShipIDUpdate(ski string, shipdID string) {
s.serviceHandler.ServiceShipIDUpdate(ski, shipdID)
}
// Provides the current pairing state for the remote service
// This is called whenever the state changes and can be used to
// provide user information for the pairing/connection process
func (s *Service) ServicePairingDetailUpdate(ski string, detail *shipapi.ConnectionStateDetail) {
s.serviceHandler.ServicePairingDetailUpdate(ski, detail)
}
// return if the user is still able to trust the connection
func (s *Service) AllowWaitingForTrust(ski string) bool {
s.mux.Lock()
defer s.mux.Unlock()
return s.isPairingPossible
}
@@ -0,0 +1,36 @@
# Use Cases
This folder contains various use case implementations for different use case actors. Each use case provides a scenario based API and messages for event / data updates.
Actors:
- `cem`: Customer Energy Management
Use Cases:
- `cevc`: Coordinated EV Charging
- `evcc`: EV Commissioning and Configuration
- `evcem`: EV Charging Electricity Measurement
- `evsecc`: EVSE Commissioning and Configuration
- `evsoc`: EV State Of Charge
- `opev`: Overload Protection by EV Charging Current Curtailment
- `oscev`: Optimization of Self-Consumption During EV Charging
- `vabd`: Visualization of Aggregated Battery Data
- `vapd`: Visualization of Aggregated Photovoltaic Data
- `cs`: Controllable System
Use Cases:
- `lpc`: Limitation of Power Consumption
- `lpp`: Limitation of Power Production
- `eg`: Energy Guard
Use Cases:
- `lpc`: Limitation of Power Consumption
- `lpp`: Limitation of Power Production
- `ma`: Monitoring Appliance
Use Cases:
- `mpc`: Monitoring of Power Consumption
- `mgcp`: Monitoring of Grid Connection Point
@@ -0,0 +1,7 @@
package api
import "github.com/enbility/spine-go/model"
//go:generate mockery
var PhaseNameMapping = []model.ElectricalConnectionPhaseNameType{model.ElectricalConnectionPhaseNameTypeA, model.ElectricalConnectionPhaseNameTypeB, model.ElectricalConnectionPhaseNameTypeC}
@@ -0,0 +1,91 @@
package api
import (
"github.com/enbility/eebus-go/api"
spineapi "github.com/enbility/spine-go/api"
)
// Actor: Customer Energy Management
// UseCase: Coordinated EV Charging
type CemCEVCInterface interface {
api.UseCaseInterface
// Scenario 1
// returns the current charging stratey
//
// parameters:
// - entity: the entity of the EV
//
// returns EVChargeStrategyTypeUnknown if it could not be determined, e.g.
// if the vehicle communication is via IEC61851 or the EV doesn't provide
// any information about its charging mode or plan
ChargeStrategy(remoteEntity spineapi.EntityRemoteInterface) EVChargeStrategyType
// returns the current energy demand
//
// parameters:
// - entity: the entity of the EV
//
// return values:
// - EVDemand: details about the actual demands from the EV
// - error: if no data is available
//
// if duration is 0, direct charging is active, otherwise timed charging is active
EnergyDemand(remoteEntity spineapi.EntityRemoteInterface) (Demand, error)
// Scenario 2
TimeSlotConstraints(entity spineapi.EntityRemoteInterface) (TimeSlotConstraints, error)
// send power limits to the EV
//
// parameters:
// - entity: the entity of the EV
// - data: the power limits
//
// if no data is provided, default power limits with the max possible value for 7 days will be sent
WritePowerLimits(entity spineapi.EntityRemoteInterface, data []DurationSlotValue) error
// Scenario 3
// return the current incentive constraints
//
// parameters:
// - entity: the entity of the EV
IncentiveConstraints(entity spineapi.EntityRemoteInterface) (IncentiveSlotConstraints, error)
// send new incentives to the EV
//
// parameters:
// - entity: the entity of the EV
// - data: the incentive descriptions
WriteIncentiveTableDescriptions(entity spineapi.EntityRemoteInterface, data []IncentiveTariffDescription) error
// send incentives to the EV
//
// parameters:
// - entity: the entity of the EV
// - data: the incentives
//
// if no data is provided, default incentives with the same price for 7 days will be sent
WriteIncentives(entity spineapi.EntityRemoteInterface, data []DurationSlotValue) error
// Scenario 4
// return the current charge plan constraints
//
// parameters:
// - entity: the entity of the EV
ChargePlanConstraints(entity spineapi.EntityRemoteInterface) ([]DurationSlotValue, error)
// return the current charge plan of the EV
//
// parameters:
// - entity: the entity of the EV
ChargePlan(entity spineapi.EntityRemoteInterface) (ChargePlan, error)
// Scenario 5 & 6
// this is automatically covered by the SPINE implementation
}
Loaded 100 of 387 files, more files were not shown because too many files have changed in this diff. Show more