ocpptest

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ocpptest provides a fake OCPP 1.6 Central System for tests of the simulated charger in client mode.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitFor

func WaitFor(t testing.TB, what string, timeout time.Duration, ok func() bool)

WaitFor polls ok until it holds or the timeout passes.

Types

type CSMS

type CSMS struct {
	// contains filtered or unexported fields
}

CSMS accepts every BootNotification, gives every StartTransaction transaction id 42, answers every other CALL with an empty result, and records what the charge point sent.

func New

func New(t testing.TB) *CSMS

New starts a Central System that stops with the test.

func (*CSMS) Actions

func (f *CSMS) Actions() []string

Actions lists the charge point's CALLs in the order they arrived.

func (*CSMS) Auths

func (f *CSMS) Auths() []string

Auths lists the Authorization header of each connection.

func (*CSMS) Call

func (f *CSMS) Call(action string, payload interface{})

Call sends a CALL to the connected charge point.

func (*CSMS) Connections

func (f *CSMS) Connections() int

Connections counts the charge point's connections so far.

func (*CSMS) Paths

func (f *CSMS) Paths() []string

Paths lists the request path of each connection.

func (*CSMS) Payloads

func (f *CSMS) Payloads(action string) []json.RawMessage

Payloads lists the payloads of one action's CALLs, in order.

func (*CSMS) Sent

func (f *CSMS) Sent(action string) int

Sent counts the CALLs of one action the charge point has sent.

func (*CSMS) SetClosed

func (f *CSMS) SetClosed(closed bool)

SetClosed makes the Central System refuse connections, as one that is down.

func (*CSMS) SetHeartbeatInterval

func (f *CSMS) SetHeartbeatInterval(s int)

SetHeartbeatInterval sets the interval the BootNotification answer gives.

func (*CSMS) URL

func (f *CSMS) URL(userinfo string) string

URL is the Central System's WebSocket URL, with userinfo ("user:pass") when it is not empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL